从 PowerShell 将 Azure 网站发布到非根文件夹 [英] Publish Azure Website to non-root folder from PowerShell
问题描述
我现在正在测试我的假设.我的 Asp.Net MVC 应用程序位于 www.myapp.com/app
,第三方 CMS 系统位于 www.myapp.com/
.
I'm testing my assumptions at the moment. I have my Asp.Net MVC application located at www.myapp.com/app
and a third-party CMS system on www.myapp.com/
.
网站的设置如 this answer
目前,我可以从 Visual Studio 手动单独发布这两个应用程序,并且效果很好.
At the moment I can publish both of the applications separately and manually from Visual Studio and it works fine.
但是,我正在尝试从使用 Azure Power-Shell 脚本的构建服务器发布我的应用程序:
However, I'm trying to publish my application from a build server where I'm using Azure Power-Shell scriplets:
PS> Publish-AzureWebsiteProject -Name myApp -Package MyWebDeployPackage.zip
但是,documentation 没有提及您是否可以使用此脚本到非根文件夹.
However, documentation does not mention if you can publish with this scriplet to a non-root folder.
我可以通过什么方式从命令行将应用程序发布到 ~/app
?
Any way I can publish an application to ~/app
from a command line?
UPD:我可以通过
msbuild .SolutionName.sln /p:DeployOnBuild=true /p:PublishProfile=ProfileName /p:Password=passwordForAzurePublishing /p:AllowUntrustedCertificate=true
其中 ProfileName
是配置为部署到 Azure 网站的子文件夹的 Web 部署配置文件,Password
是来自 Azure 配置文件的部署密码.
Where ProfileName
is a web-deploy profile configured to deploy to sub-folder of Azure Web-Site and Password
is deployment password from Azure profile.
但这不是最佳解决方案:要部署到测试环境和生产环境,我需要构建应用程序两次,我想避免这种情况:如果我编译视图,则需要 7-10 分钟(我们有800 次观看).这样做两次是浪费时间.
However this is not an optimal solution: to deploy to test and to production environment, I need to build the application twice, which I'd like to avoid: if I compile views, it takes 7-10 minutes (we have 800 views). Doing this twice is a waste of time.
UPD 2:在 Azure SDK 工具存储库上创建了一个问题:https://github.com/Azure/azure-sdk-tools/issues/2667
UPD 2: Created an issue on Azure SDK Tools repository: https://github.com/Azure/azure-sdk-tools/issues/2667
推荐答案
我认为这在 PowerShell 中是不可能的,但我可能弄错了.在这里查看他们的发布代码 https://github.com/Azure/azure-sdk-tools/blob/master/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs#L1136-L1168
I don't think this is possible from PowerShell, but I might be mistaken. Looking at their publish code here https://github.com/Azure/azure-sdk-tools/blob/master/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs#L1136-L1168
他们没有应用名称的参数,第二个链接中的代码手动构建站点名称/插槽.
they don't have a parameter for the app name, and the code in the second link builds the site name/slot manually.
我想说在这里打开一个问题 https://github.com/Azure/azure-sdk-tools/issues 为此,Azure PowerShell 团队的人员应该查看它.
I would say open an issue here https://github.com/Azure/azure-sdk-tools/issues for this and somebody from the Azure PowerShell team should look at it.
这篇关于从 PowerShell 将 Azure 网站发布到非根文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!