Can't publish ASP.NET Core 1.0 RC2 Application on build server

时光总嘲笑我的痴心妄想 提交于 2019-12-07 10:54:12

问题


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.

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

I'm able to build the solution.

The problem is: I can't publish it!

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): 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]

I've re-created the publish profiles with Visual Studio (the powershell script generated is different than the one with the RC1)

The publish works fine locally, where I have Visual Studio installed.

The question is:

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.

Thanks


回答1:


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:

What I did so far:

The project.json got:

 "publishOptions": {
    "include": [
      "appsettings.json",
      "hosting.json",
      "web.config"
    ]
  },
  "scripts": {
    "postpublish": [
      "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:project.Bla%"
    ]
  }, 

Build steps are:

  1. dotnet restore on the solution directory
  2. msbuild solution
  3. dotnet publish on the specific project directory

e.g:

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


来源:https://stackoverflow.com/questions/37395651/cant-publish-asp-net-core-1-0-rc2-application-on-build-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!