Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent msbuild command for Publish from VS2008

any idea which is the command for publish in msbuild corresponding to the one in VS2008? What I want is the resulting output to be the same, without that _PublishedWebSites subdirectory. Is this achievable from command line or I should use a build file?

Thanks.

like image 479
Adrian Magdas Avatar asked Nov 24 '08 09:11

Adrian Magdas


People also ask

How do I publish my website with MSBuild?

Command to build a solution using MsBuild.exe In the above command we build the whole solution now to publish specific web project we have to use "PublishProfile" parameter, to use publish profile parameter you have to create publish profile first then pass the profile name in this parameter.

How do I run MSBuild from command prompt?

Use MSBuild at a command prompt To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.

What command does Visual Studio use to publish?

Basic command-line publishing The default publish folder format is bin\Debug\{TARGET FRAMEWORK MONIKER}\publish\. For example, bin\Debug\netcoreapp2. 2\publish\. The dotnet publish command calls MSBuild, which invokes the Publish target.

What is publish profile in MSBuild?

A publish profile is just an MSBuild file. When you pass in PublishProfile and DeployOnBuild=true, then the publish profile is Imported into the build/publish process. It will supply the publish properties needed to perform the publish.


2 Answers

Solved this by specifying WebProjectOutputDir property.
It looks something like this:
MSBuild.exe /t:Rebuild "MyTestProject.sln" /p:OutDir=c:\Project\bin\ /p:WebProjectOutputDir=C:\Project\ /p:Configuration=Debug

like image 114
Adrian Magdas Avatar answered Nov 08 '22 05:11

Adrian Magdas


You can also check out these blog posts:
- http://blog.m.jedynak.pl/2008/03/publishing-web-application-with-msbuild.html
- http://codingcockerel.co.uk/2008/05/18/how-to-publish-a-web-site-with-msbuild/

like image 20
Piotr Owsiak Avatar answered Nov 08 '22 07:11

Piotr Owsiak