下载web deploy:
https://www.iis.net/downloads/microsoft/web-deploy
安装web deploy:
http://edi.wang/Post/2013/12/21/iis-webdeploy-on-ws2008r2
安装web deploy以及进行部署
https://blog.csdn.net/codec007/article/details/46442957
BuildTool:
正确命令:
FileSystem(推荐,简单)
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" /p:DeployOnBuild=true /p:PublishProfile=Server1Profile /p:WebPublishMethod=FileSystem "E:\MyProject\Myproject.Web.csproj"
MsDeploy(维护方便,但前期需要配置)
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" /p:DeployOnBuild=true /p:PublishProfile=Server1Profile /p:WebPublishMethod=MSDeploy E:\MyProject\Myproject.Web.csproj
Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
nuget的版本为3.5版本,其对应的MSBuild版本为14,而服务器上未安装此版本MSBuild。
解决方案:安装对应MSBuild版本的BuildTool工具
另外可行:运行命令nuget update -self更新至最新版本,但同时意味着package里的内容也会相应需要更新。
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
查找原因,答案大部分为给项目添加reference,因为此项目都是使用nuget获取package,reference需要恢复,直接引用不方便。折衷方案:添加<>到各个csproj中去
使用类型为WebDeploy的Profile进行publish
Msbuild WebPublishMethod does not have a valid value. Current Value is ‘’
此问题为未制定WebPublishMethod的参数
public class global_asax : global::Agency.Web.MvcApplication CS0012: The type 'System.Object' is defined in an assembly that is not referenced.
解决方案:拷贝netstandard.dll进bin文件夹中
ERROR_DESTINATION_NOT_REACHABLE
未安装Web deploy, 或者服务器未启动Web Deployment Agent Service,或者服务器打开了防火墙
ERROR_USER_NOT_ADMIN ... Web Deployment Agent Service, but could not authorize. Make sure you are an administrator on
问题为credential无效,不能进行web deploy发布,使用参考4, 5, 6进行配置允许匿名用户发布,中间遇到问题,未果。
可以进行部署,运行起网站的时候报错缺少若干dll
因为MSBuild运行在服务器上,服务器缺少一些dll环境或者dll版本比较旧,
解决方案:从正常发布的文件夹中拷贝出dll并进行/拷贝替换bin目类下对应项
页面不再报错,但是网站无法显示出来,空白页
查看windows log,发现有错误日志:ABP编译过程缺少dll,
解决方案:继续使用拷贝替换bin目类下dll的方式。
【参考】
1, https://stackoverflow.com/questions/46461278/msbuild-webpublishmethod-does-not-have-a-valid-value
3, https://stackoverflow.com/questions/16246562/using-msbuild-to-execute-a-file-system-publish-profile
4, https://forums.asp.net/t/2126876.aspx?WebDeploy+ERROR_USER_NOT_ADMIN
6, https://forums.iis.net/t/1190239.aspx
8, nuget build checker https://github.com/NuGet/Home/issues/4091
9, nuget error version https://github.com/NuGet/Home/issues/4091
10, add netstandard reference to project https://github.com/dotnet/standard/issues/542
11, nuget cli command https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference
12: Jenkins需要安装插件NodeJS Plugin
13, netstandard reference https://davidsekar.com/asp-net/you-must-add-a-reference-to-assembly-netstandard