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

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

问题描述:

我正在尝试使用NAnt和MSBuild在本地发布一个Asp.net MVC Web应用程序。这是我正在使用的NAnt目标;

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.

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

Is it possible to publish web applications via the command line in this way?

您尝试调用的发布目标是OneClick部署,而不是发布网站...这就是为什么你得到看似陌生的消息。
您将要使用AspNetCompiler任务,而不是MSBuild任务。请参阅 http://msdn2.microsoft.com/en-us/library/ms164291。 aspx 有关此任务的更多信息。您的PublishDir将对应于任务的TargetPath属性。

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.

来源