How do I publish a Asp.NET web application using MSBuild?
Solution 1
The "Publish" target you are trying to invoke is for "OneClick" deployment, not for publishing a website... This is why you are getting the seemingly bizarre message. You would want to use the AspNetCompiler task, rather than the MSBuild task. See http://msdn2.microsoft.com/en-us/library/ms164291.aspx for more info on this task. Your "PublishDir" would correspond to the TargetPath property of the task.
Solution 2
I came up with such solution, works great for me:
msbuild /t:ResolveReferences;_WPPCopyWebApplication /p:BuildingProject=true;OutDir=C:\Temp\buidl\ Test.csproj
Secret sauce is _WPPCopyWebApplication target.
Related videos on Youtube
Xian
Flipper of the 1's and 0's, bit herder for Forward Internet group. Agile practitioner, systems thinker. Prolific non-blogger
Updated on June 23, 2020Comments
-
Xian almost 4 years
I am trying to publish an Asp.net MVC web application locally using the NAnt and MSBuild. This is what I am using for my NAnt target;
<target name="publish-artifacts-to-build"> <msbuild project="my-solution.sln" target="Publish"> <property name="Configuration" value="debug" /> <property name="OutDir" value="builds\" /> <arg line="/m:2 /tv:3.5" /> </msbuild> </target>
and all I get is this as a response;
[msbuild] Skipping unpublishable project.
Is it possible to publish web applications via the command line in this way?
-
Kiquenet almost 13 yearsWhere is _WPPCopyWebApplication ? I have VS 2008 and vbproj.
-
Alexander Beletsky almost 13 yearsI think it won't work for 2008 :( .. this target is defined here: "C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets"
-
Garrison Neely about 12 yearsThis answer worked for me in VS 2010. I am using a batch file that calls MSBuild. Publish task was deploying the code out, but it wasn't interpreting my Configuration setting (so I got web.config, web.configuration.config in the deploy location, and it hadn't performed the xdt transforms). When I used ResolveReferences;_WPPCopyWebApplication my published files parsed the configuration as expected, resulting in one web.config that had all the transforms performed.
-
Garrison Neely about 12 yearsFor the record, I actually had to switch the order of the targets. The deploy files from ResolveReferences;_WPPCopyWebApplication were missing some DLLs in the bin, which caused errors. When I switched the order to _WPPCopyWebApplication;ResolveReferences, all the DLLs were maintained as expected.