如何使用命令行发布 Asp.Net MVC 2 应用程序?

发布于 2024-09-29 17:06:32 字数 189 浏览 0 评论 0原文

在 Visual Studio 2010 中,我们可以右键单击 Web 应用程序,然后从菜单中选择“发布”。使用它,我们可以将 Web 应用程序发布到文件系统。

我们如何使用命令行实现相同的目的?

编辑:虽然我们可以按照建议使用 xcopy,但它与发布命令不同,因为我们必须手动排除不必要的文件。

In Visual Studio 2010 we can right click a Web application and select Publish from the Menu. Using this we can publish a web application to a File System.

How can we achieve the same using Command line?

EDIT: Although we can use xcopy as suggested it is not same as Publish command as we have to manually exclude unnecessary files.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

乙白 2024-10-06 17:06:32

您正在寻找 Aspnet_compiler.exe 使用命令行发布。

如果使用 MSBuild,则需要 AspNetCompiler 任务

Aspnet_compiler 提供的选项与 Visual Studio 的“发布”选项提供的选项相同。

You're looking for Aspnet_compiler.exe to publish using the command line.

If using MSBuild then you need the AspNetCompiler Task.

The options the Aspnet_compiler provides are the same as those provided by Visual Studio's Publish option.

毁梦 2024-10-06 17:06:32

您可以将可选属性传递给 MSBuild 脚本以调用 MSDeploy(假设您已在客户端/服务器上进行设置)。

/p:DeployOnBuild=True – 这将让我们在构建后进行部署

/p:DeployTarget=MsDeployPublish – 这设置了我们如何使用 MSDeploy 进行部署

/p: MSDeployServiceURL=http:///MsDeployAgentService

/p:DeployIISAppPath="Default Web Site" – 应用程序部署的路径

/p:CreatePackageOnPublish=True > – 创建包来部署应用程序

/p:MsDeployPublishMethod=RemoteAgent – 安装 MSDeploy 的服务器。可能的值有:

RemoteAgent – 当 MSDeploy 部署在另一台计算机上时

InProc – 部署到本地 IIS

/p:AllowUntrustedCertificated=True – 连接到 MSDeployServiceURL,而不尝试使用证书。

要使用证书,您应该使用 MSDeployServiceURL 上的另一个 URL。

/p:UserName=username – 有权部署应用程序的用户的用户名

/p:Password=password – 该用户的有效密码 :)

取自 < a href="http://blogs.allmatech.com.br/Blogs/ALMTeam/post/Creating-a-Build-Definition-to-work-with-MSDeploy.aspx" rel="nofollow">Allmatech ALM 团队< /a>

You can pass optional properties to the MSBuild script to call MSDeploy (Assuming you have it setup on both the client/server).

/p:DeployOnBuild=True – This will let us deploy after build

/p:DeployTarget=MsDeployPublish – This set how we will deploy, using MSDeploy

/p:MSDeployServiceURL=http:///MsDeployAgentService

/p:DeployIISAppPath="Default Web Site" – The path where the app will be deployed

/p:CreatePackageOnPublish=True – Create a package to deploy the App

/p:MsDeployPublishMethod=RemoteAgent – Server where the MSDeploy is installed. The possible values for this are:

RemoteAgent – When the MSDeploy is deployed at another machine

InProc – Deploy to the Local IIS

/p:AllowUntrustedCertificated=True – Connect to the MSDeployServiceURL without trying to use certificate.

To use a certificate you should use another URL on the MSDeployServiceURL.

/p:UserName=username – The username of a user with permission to Deploy the application

/p:Password=password – a VALID password for that user :)

Taken from Allmatech ALM Team

深海蓝天 2024-10-06 17:06:32

你尝试过这样的事情吗

xcopy *.* \\server\folder

Have you tried something like this

xcopy *.* \\server\folder
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文