微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

asp.net-mvc – 如何使用MsBuild MsDeployPublish来定位本地文件系统?

我试图复制Visual Studio 2010“发布…”命令(适用于Web应用程序项目),我将在UI中选择发布方法:“文件系统”.

我的尝试是…

%msbuild% /t:MsDeployPublish /property:MsDeployServiceUrl=”file:///d:\MyDeploymentFolder”;MsDeployPublishMethod=”File System” “d:\MySourceFolder\Project.csproj”

…并尝试了“FileSystem”,“File System”,“Local”等几种方法.

我得到的错误意味着MsDeploy仍然试图推送到IIS服务器

"D:\MySourceFolder\Project.csproj" (MsDeployPub
lish target) (1) ->
(MSDeployPublish target) ->
  C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web
.Publishing.targets(3847,5): error : Web deployment task Failed.(The Metabase k
ey '/lm/w3svc' Could not be found.) [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : \r [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : The Metabase key '/lm/w3svc' Could not be fo
und.\r [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : Unable to access the IIS configuration syste
m. Please make sure you have IIS 7 (or later) installed.\r [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : Retrieving the COM class factory for compone
nt with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} Failed due to the followin
g error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REG
DB_E_CLASSNOTREG)). [D:\MySourceFolder\Project.csproj]

如何定位文件系统进行部署,因为Visual Studio通常允许我在GUI中?

解决方法

根据我从 Using MSBuild,how do I build an MVC4 solution from the command line (applying Web.config transformations in the process) and output to a folder?的答案
msbuild ProjectFile.csproj /p:Configuration=Release ^
                           /p:Platform=Anycpu ^
                           /t:WebPublish ^
                           /p:WebPublishMethod=FileSystem ^
                           /p:DeleteExistingFiles=True ^
                           /p:publishUrl=c:\output

或者如果您正在构建解决方文件

msbuild Solution.sln /p:Configuration=Release ^ 
                     /p:DeployOnBuild=True ^
                     /p:DeployDefaultTarget=WebPublish ^
                     /p:WebPublishMethod=FileSystem ^
                     /p:DeleteExistingFiles=True ^
                     /p:publishUrl=c:\output

原文地址:https://www.jb51.cc/aspnet/250515.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐