Question

I am defining a property in the .csproj file

 <PropertyGroup>
<ProjectGuid>{3099AE33-98E7-4018-B0C3-4C3A37A6D56E}</ProjectGuid>
<OutputType>Exe</OutputType>
<!-- Property for CASI Dev Build location -->
<AppRoot>$(INETROOT)\target\distrib\$(BuildType)\$(BuildArchitecture)\CASI_Dev</AppRoot>
<DeploymentBranch>Dev</DeploymentBranch>

I also have a referenced project: say

<ItemGroup>
<ProjectReference Include="$(INETROOT)\refproj.csproj">
  <Project>{F73278A5-AB7E-4FFD-8592-F135E7DB06F2}</Project>
  <Name>RemoteProj</Name>
</ProjectReference>

Is there some way to access the property $(DeploymentBranch) or $(AppRoot) in the referenced project i.e in file refproj.csproj.

If i try to access them now the value is blank

Was it helpful?

Solution

Based on what I know about MsBuild this is not possible by "standard" way. But here are the options you can achieve it: 1) Pass property values in MSBuild command line for building your root solution: msbuild mySolution.sln /t:Build /p:Configuration=...;Platform=...;DeploymentBranch=...;AppRoot=...

2) In your refproj.csproj, you can import main.csproj . but keep in mind the "relativeness" of your paths and that main.csproj might override your refproj.csproj properties and targets.

See more information here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top