Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 671
Francois Avatar asked Apr 24 '17 11:04

Francois


People also ask

How do I publish a solution using MSBuild?

You can use the created profile to publish from the command line with a command line the following. If you want to store the publish profile (. pubxml file) in some other location you can pass in the path as the value for the PublishProfile property. Publish profiles are MSBuild files.

How do you clean MSBuild solution?

Cleaning up specific projects: msbuild MyProjectFile1 /t:Clean msbuild MyProjectFile2 /t:Clean ... This has to be repeated for all projects you need to clean, because MSBuild only accepts single project on command line.

Is it possible to build an application on a system if the MSBuild is not installed?

Is it possible to build an application on a system if the MSBuild is not installed? If so, How? Yes, it is actually possible because the MSBuild doesn't depend on the Visual Studio of its operations. Users simply need to install the msbuild.exe file for this.

What is the difference between MSBuild and Visual Studio build?

Visual Studio determines the build order and calls into MSBuild separately (as needed), all completely under Visual Studio's control. Another difference arises when MSBuild is invoked with a solution file, MSBuild parses the solution file, creates a standard XML input file, evaluates it, and executes it as a project.


1 Answers

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

like image 151
DeJaVo Avatar answered Sep 19 '22 10:09

DeJaVo