Description
Discussed in dotnet/msbuild#7138
Originally posted by hallambaker December 8, 2021
I have a large project that supports ten separate platforms with customized builds for each. So I want to be able to script this.
When I publish from within VS, it uses the parameters specified in the .pubxml file.
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>x64</Platform>
<PublishDir>..\..\Outputs\win-x64</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net6.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>True</PublishSingleFile>
<PublishReadyToRun>True</PublishReadyToRun>
<PublishTrimmed>True</PublishTrimmed>
</PropertyGroup>
</Project>
When I try to do the same thing from msbuild, it ignores the settings in the .pubxml which is really weird because that is the file I specified on the command line.
msbuild mmm.sln /p:PublishProfile=publish-win-x64 -verbosity:quiet
Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
...
Instead of building the Release configuration specified in the .pubxml, it builds the Debug, it doesn't publish a single file and it doesn't put it where I specified.
How can I get Msbuild to publish using the settings from the pubxml?
Why is this not considered a bug?
I did have some conversations with a team member who advised me to basically respecify everything on the command line. But the documentation is non existent, incomplete and conflicting.
All my code is in.
https://github.com/hallambaker/Mathematical-Mesh
Am I somehow getting an obsolete version of Msbuild? I don't think so:
C:\Users\hallam> where msbuild
C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe