I am using Visual Stduio 2015 Community Edition. I have loaded a C# project and want to configure it to use shadow building, so that source files are not messed up with any binaries or intermediate build files. Tried to set the [output]/[intermediate output] directory paths of the C# project using the VS UI – the only UI-editable output path is the “bin” one and it doesn’t accept MSBuild macros. Then I’ve unloaded the project and manually edited it. Also set the IntermediateOutputPath which is not available in the VS UI when using C# project, but when using C++ one all such kind of directories are editable.
Currently, the OutputPath is set to:
$(ProjectName) is empty for some reason. Tried
$(TargetName) (it is not correct to use it but just for the test) but it is empty, too. Any suggestions?
Do not try to import
Microsoft.CSharp.targets - like suggested in another answer.
First of all - it will lead to additional warning like
Warning MSB4011: "Microsoft.CSharp.targets" cannot be imported again. ...
But additionally to that if you try to edit pre-/post- build Visual studio will crash. (Observed in Visual studio 2019, 16.7.7 version)
Better to use
$(MSBuildProjectName) macro instead of
$(ProjectName) - works identically.
Answered by TarmoPikaro on February 22, 2021
The problem is that some of the MSBuild properties like ProjectName are set after the following line in your .csproj file.
<Import Project="$(MSBuildBinPath)Microsoft.CSharp.targets" />
After this line you can access all variables.
Answered by Steven Spyrka on February 22, 2021
5 Asked on November 30, 2020 by swetha-haridoss
2 Asked on November 29, 2020 by perdugames
2 Asked on November 29, 2020 by stackoverflow_user
2 Asked on November 29, 2020 by user026
2 Asked on November 29, 2020 by arthu-vinicius-demetrio-santia
2 Asked on November 29, 2020 by wai-yan-hein
1 Asked on November 29, 2020 by kleiton-kurti
2 Asked on November 28, 2020 by soul-true
1 Asked on November 28, 2020 by thomas-martin
2 Asked on November 28, 2020 by ashot-aleqsanyan
0 Asked on November 28, 2020 by david-wohlferd
3 Asked on November 28, 2020
0 Asked on November 28, 2020 by ye-k
1 Asked on November 28, 2020 by jimenemex
Get help from others!