Reputation: 41
Publish profile for a .NET project was created in Visual Studio for Release Build Configuration. Running MSBuild from command line using said profile builds the project as Debug. Clearly the Build Configuration chosen in Visual Studio is not respected by MSBuild.
Upvotes: 0
Views: 778
Reputation: 41
The problem is that the Build Configuration chosen in Visual Studio is only used by Visual Studio.
This is the property VS creates in the publish profile XML:
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
Changing it to the following fixes the problem:
<Configuration>Release</Configuration>
The provided solution works for both VS and MS build from command line.
Answer initially provided by vijayrkn here:
https://github.com/Microsoft/msbuild/issues/1901#issuecomment-404299611
Upvotes: 3