无法在生成服务器上发布ASP.NET Core 1.0 RC2应用程序 [英] Can't publish ASP.NET Core 1.0 RC2 Application on build server
问题描述
我在构建服务器上没有Visual Studio.从DNX(RC1)迁移到.NET后我在TeamCity上构建的Core CLI(RC2)中断了.
I don't have Visual Studio on the build server. After migrating from DNX (RC1) to .NET Core CLI (RC2) my build on TeamCity broke.
确定我已将MSBuild目标从我的PC复制到构建服务器后:
After making sure I had copied the MSBuild targets from my PC to the build server:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet
我能够构建解决方案.
问题是:我无法发布!
当我运行:MSBuild.exe Solution.sln /p:DeployOnBuild=true /p:publishprofile=local
时,它将失败并显示:
When I run: MSBuild.exe Solution.sln /p:DeployOnBuild=true /p:publishprofile=local
it will fail with:
C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ DotNet \ Microsoft.DotNet.Publishing.targets(406,5):错误:发布期间发生错误. [d:\ path \ project.xproj] C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ DotNet \ Microsoft.DotNet.Publishing.targets(406,5):错误:无法将参数绑定到参数'Path',因为它是一个空字符串. [d:\ path \ project.xproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing.targets(406,5): error : An error occurred during publish. [d:\path\project.xproj] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing.targets(406,5): error : Cannot bind argument to parameter 'Path' because it is an empty string. [d:\path\project.xproj]
我已经用Visual Studio重新创建了 publish 配置文件(生成的powershell脚本与使用RC1的脚本不同)
I've re-created the publish profiles with Visual Studio (the powershell script generated is different than the one with the RC1)
该发布在本地运行良好,安装了Visual Studio.
The publish works fine locally, where I have Visual Studio installed.
问题是:
要添加/p:DeployOnBuild=true /p:publishprofile=
而无需安装Visual Studio就能运行MSBuild,我需要添加到构建服务器中的内容.
What do I need to add to the build server, to be able to run MSBuild with /p:DeployOnBuild=true /p:publishprofile=
without having to install Visual Studio.
谢谢
推荐答案
我不会将其标记为答案,因为我仍然希望获得 right 答案,但是要帮助其他获得帮助的人像我一样卡住:
I won't mark this as the answer as I'm still hoping for the right answer, but to help others who got stuck like me:
我到目前为止所做的:
project.json 得到了:
"publishOptions": {
"include": [
"appsettings.json",
"hosting.json",
"web.config"
]
},
"scripts": {
"postpublish": [
"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:project.Bla%"
]
},
构建步骤为:
-
解决方案目录上的
- dotnet恢复
- msbuild解决方案
- dotnet发布在特定项目目录上
- dotnet restore on the solution directory
- msbuild solution
- dotnet publish on the specific project directory
例如:
d:\project\Project.Bla>dotnet publish -c Release
Publishing Project.Bla for .NETFramework,Version=v4.5.2/win7-x64
Project Project.Bla (.NETFramework,Version=v4.5.2) was previously compiled. Skipping compilation.
Project Project.Ble (.NETFramework,Version=v4.5.2) was previously compiled. Skipping compilation.
...
Configuring the following project for use with IIS: 'd:\project\Project.Bla\bin\Release\net452\win7-x64\publish'
Updating web.config at 'd:\project\Project.Bla\bin\Release\net452\win7-x64\publish\web.config'
Configuring project completed successfully
publish: Published to d:\project\Project.Bla\bin\Release\net452\win7-x64\publish
Published 1/1 projects successfully
这篇关于无法在生成服务器上发布ASP.NET Core 1.0 RC2应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!