Search code examples
msbuildvisual-studio-2017msbuild-15

MSBuild deploy only - no build


Is there anyway to do the publish/deploy part of a /p:DeployOnBuild=true call to MSBuild? For instance, doing the build in one call, then the publish (file copy) in another call.

There is an issue with MSBuild 15 and publish profiles when called from command line.


Solution

  • A post on Github addressing the same concern raised by you has provided a solution.

    You can find documentation on how to use PublishProfiles from commandline here - https://github.com/aspnet/websdk#folder-publish

    Here is a sample project with a PublishProfile: https://github.com/vijayrkn/dotnetpublishprofilesample/blob/7dac43543173b4ce908921106cc84d810c6dc623/WebPublishCommandlineSample/Properties/PublishProfiles/SampleFolderProfile.pubxml

    MSBuild command to publish to a folder using the above publish profile: https://github.com/vijayrkn/dotnetpublishprofilesample/blob/7dac43543173b4ce908921106cc84d810c6dc623/PublishCommandline.txt

    I would be happy to take a look at the issue if some one can provide me a sample project & msbuild command that is not working.

    Source: https://github.com/Microsoft/msbuild/issues/1901#issuecomment-377140715

    Hope it provides the needed information

    Note: issue was fixed by Microsoft - https://github.com/dotnet/cli/pull/8996 as part of 2.1.3xx milestone