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.
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.
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.
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.
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.
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
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With