如何使用MSBuild发布Asp.NET Web应用程序?

时间:2020-11-29 03:33:30

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;

我试图使用NAnt和MSBuild在本地发布Asp.net MVC Web应用程序。这是我用于我的NAnt目标的东西;

<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?

是否可以通过命令行以这种方式发布Web应用程序?

2 个解决方案

#1


21  

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.

您尝试调用的“发布”目标是“OneClick”部署,而不是用于发布网站...这就是您收到看似奇怪的消息的原因。您可能希望使用AspNetCompiler任务,而不是MSBuild任务。有关此任务的详细信息,请参阅http://msdn2.microsoft.com/en-us/library/ms164291.aspx。您的“PublishDir”将对应于任务的TargetPath属性。

Source

资源

#2


14  

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.

秘密酱是_WPPCopyWebApplication目标。

#1


21  

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.

您尝试调用的“发布”目标是“OneClick”部署,而不是用于发布网站...这就是您收到看似奇怪的消息的原因。您可能希望使用AspNetCompiler任务,而不是MSBuild任务。有关此任务的详细信息,请参阅http://msdn2.microsoft.com/en-us/library/ms164291.aspx。您的“PublishDir”将对应于任务的TargetPath属性。

Source

资源

#2


14  

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.

秘密酱是_WPPCopyWebApplication目标。