【问题标题】:How do I deploy .net core rc2 projects via msbuild / msdeploy?如何通过 msbuild / msdeploy 部署 .net core rc2 项目?
【发布时间】:2016-06-16 21:34:20
【问题描述】:

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

  • 本地 IIS
  • Azure Web 应用程序
  • Web 部署包

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

通过 Visual Studio Publishing UI 时,我只看到 File SystemMicrosoft Azure App Service 作为选项。文件系统不制作 web 部署包,我们希望继续使用部署包技术,特别是在不同环境之间促进相同的构建。

一般来说,任何关于通过 msbuild 以类似于我们之前所做的方式部署 .net core rc2 应用程序的建议都会很棒。但是,具体来说,我想知道如何通过 msbuild 将 .net core rc2 项目部署到 web 部署包。感谢您的建议!

【问题讨论】:

标签: msbuild web-deployment msdeploy .net-core .net-core-rc2


【解决方案1】:

请注意:围绕 .NET Core 和 ASP.NET Core 的工具处于“Preview 1”中尚未完成,我提出的解决方案可能会随着下一个版本而改变。

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

我刚刚使用 FAKE (F# Make) 配置了一个持续部署过程,但如果您对它有更深入的了解,它也应该适用于 MSBuild。

第一步是使用“dotnet publish”使用如下参数部署到特定文件夹:

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

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

"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 进行尝试,您会在发布输出窗口中看到它。

【讨论】:

  • 非常感谢您的帮助!这看起来对我们有用!希望他们很快完成,我想在 rc2 中使用很多很棒的东西
  • 您可以在此处找到有关命令行用法的更多文档 - github.com/aspnet/websdk#microsoftnetsdkpublish
【解决方案2】:

非常感谢!为我工作!

我用过:

$website = Get-AzureWebsite -Name [AzureWebsiteName]

# get the SCM URL to use with MSDeploy.  
# by default this will be the second in the array.
$msDeployHost = $website.EnabledHostNames[1]

然后我像这样创建了 -dest:contentPath

$destPath="$($website.Name),ComputerName='https://$msDeployHost/msdeploy.axd',UserName='$($website.PublishingUsername)',Password='$($website.PublishingPassword)',IncludeAcls='False',AuthType='Basic'"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-24
    • 1970-01-01
    相关资源
    最近更新 更多