Configuration for ProjectReference in MSBuild
Asked Answered
U

2

10

Is it possible to set the configuration of ProjectReference in MSBuild?

Scenario: I have a build script (web deploy) that has a number of configurations where the only difference has to do with how they are deployed and not the build it self. I would hate to have to maintain configurations for my solution/projects that are build as a part of the deploy process just because I need those configurations for deployment. Any way I can accomplish this?

Unnecessary answered 8/7, 2011 at 12:5 Comment(1)
Ask "should this answer be deleted for malicious content" and in the body provide all the details you got. I went to the site in chrome and didn't see anything, so I can't make a judgement on it. Asking on meta gets more eyes involved.Liable
U
2

Leaving the question in case some one else gets the same idea as I did. The solution was pretty straight forward. Don't do it. Turn it around. Just use any other property for the deployment script and map the different deployment configuration to existing Project configurations.

Unnecessary answered 8/7, 2011 at 12:28 Comment(0)
G
13

Another possible method of setting ProjectReference configuration and platform is to use a property picked up the MSBuild's reference handling code called SetPlatform and SetConfiguration. Example:

<ProjectReference Include="path to project.projext">
  <SetPlatform>Platform=x64</SetPlatform>
  <SetConfiguration>Configuration=Release</SetConfiguration>
</ProjectReference>
Glob answered 26/8, 2015 at 20:58 Comment(1)
Do you happen to know if there if a way to get the configuration of a ProjectReference instead of setting it? I can successfully access %(ProjectReference.Name), but I can't access the configuration.Cherub
U
2

Leaving the question in case some one else gets the same idea as I did. The solution was pretty straight forward. Don't do it. Turn it around. Just use any other property for the deployment script and map the different deployment configuration to existing Project configurations.

Unnecessary answered 8/7, 2011 at 12:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.