I have 3 projects with configuration:
Project C have B in dependencies and B have A in dependencies. (A <- B <- C)
I use *.bat file to build its from command line:
msbuild A.csproj /target:Build /property:Configuration=Debug;Platform=AnyCPU /verbosity:minimal
msbuild A.csproj /target:Build /property:Configuration=Release;Platform=AnyCPU /verbosity:minimal<br/>
msbuild B.csproj /target:Build /property:Configuration=Debug;Platform=AnyCPU /verbosity:minimal
msbuild B.csproj /target:Build /property:Configuration=Release;Platform=AnyCPU /verbosity:minimal
msbuild C.csproj /target:Build /property:Configuration=Debug;Platform=x86 /verbosity:minimal
msbuild C.csproj /target:Build /property:Configuration=Release;Platform=x86 /verbosity:minimal
msbuild C.csproj /target:Build /property:Configuration=Debug;Platform=x64 /verbosity:minimal
msbuild C.csproj /target:Build /property:Configuration=Release;Platform=x64 /verbosity:minimal
And recieve error:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(609,5): error : The OutputPath property is not set for project 'A.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='x86'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [A.csproj] C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(609,5): error : The OutputPath property is not set for project 'B.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='x86'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [B.csproj]
I found the solution for my problem. Use Choose element in *.csproj file for detect building via Visual Studio or via MSBuild and use Reference (instead of ProjectReference) for MSBuild.
<Choose>
<When Condition="'$(BuildingInsideVisualStudio)' == 'true'">
<ItemGroup>
<ProjectReference Include="A.csproj">
<Project>{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}</Project>
<Name>A</Name>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="B.csproj">
<Project>{BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB}</Project>
<Name>B</Name>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="A, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx, processorArchitecture=MSIL">
<HintPath>A.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="B, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx, processorArchitecture=MSIL">
<HintPath>B.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
</Otherwise>
</Choose>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With