如何通过msbuild/msdeploy部署.net core rc2项目?

问题描述:

当前,我们通过使用DeployOnBuild=truePublishProfile=Whatever参数调用MSBuild.exe来部署Web应用程序项目(csproj),以将我们的项目部署到以下其中之一:

Currently we deploy our web application projects (csproj's) via a call to MSBuild.exe with the DeployOnBuild=true and PublishProfile=Whatever parameters to deploy our projects to one of the following:

  • 基于IIS的
  • Azure Web应用程序
  • Web部署程序包

我们想开始使用新的.net核心rc2项目,但是我们真的不确定如何部署它们.我们可以使用较旧的发布配置文件/发布方法吗?

We'd like to begin using the new .net core rc2 projects, but we're really not sure how to deploy them. Can we use the older publish profiles / publish methods?

通过Visual Studio发布UI时,我仅将File SystemMicrosoft Azure App Service作为选项.文件系统没有制作Web部署程序包,我们希望继续使用部署程序包技术,尤其是在不同环境之间升级同一内部版本时.

When going thru the Visual Studio Publishing UI, I only see File System and Microsoft Azure App Service as options. The File System doesn't make a web deployment package and we'd like to continue using the deployment package technique, especially for promoting the same build between different environments.

通常,关于通过msbuild部署.net核心rc2应用程序的任何建议都将类似于我们以前所做的任何建议.但是,具体地说,我想知道如何通过msbuild将.net core rc2项目部署到Web部署程序包中.感谢您的任何建议!

In general, any advice on deploying .net core rc2 apps via msbuild in a manner similar to what we previously did, would be fantastic. However, specifically, I'd like to know how to deploy .net core rc2 projects to web deployment packages via msbuild. Thanks for any advice!

仅需注意:围绕.NET Core和ASP.NET Core的工具尚未完成预览1",因此我提出的解决方案可能会随着下一个版本.

Just as a note: The tooling around .NET Core and ASP.NET Core is in "Preview 1" not finished yet and my proposed solution could change with the next version.

无论如何. msdeploy.exe仍在运行,但需要有关msdeploy CLI的一些知识.

Anyway. msdeploy.exe is still working but needs some knowledge about the msdeploy CLI.

我刚刚使用FAKE(F#Make)配置了一个连续部署过程,但是如果您对它有更深入的了解,它也可以与MSBuild一起使用.

I just configured a continuous deployment process using FAKE (F# Make) but it should also work with MSBuild, if you have some deeper knowledge of it.

第一步是使用"dotnet publish"将此类参数部署到特定文件夹:

The first step is to use "dotnet publish" to deploy to a specific folder using arguments like this:

"dotnet publish " + webPath + " --framework net461 --output " + publishFolder + 
    " --configuration " + buildConf + " --no-build"

不需要使用类似以下参数的参数来调用msdeploy.exe:

Than you need to call msdeploy.exe with arguments similar to this:

"msdeploy.exe -source:contentPath=" + publishFolder + " -dest:contentPath=" + targetFolder + 
    ",ComputerName=" + computerName + ",UserName='" + username + "',Password='" + publishPassword + 
    "',IncludeAcls='False',AuthType='Basic' -verb:sync -enablerule:AppOffline -enableRule:DoNotDeleteRule -retryAttempts:20"

如果您发布到Azure,则Visual Studio的功能完全相同.如果您使用Visual Studio进行尝试,则会在发布输出"窗口中看到它.

Visual Studio does exactly the same, if you publish to Azure. If you try it with Visual Studio, you'll see that in the publish output window.