无法在构建服务器

时间:2016-05-23 16:04:09

标签: msbuild asp.net-core .net-core .net-core-rc2

我在构建服务器上没有Visual Studio。 After migrating from DNX (RC1) to .NET Core CLI (RC2) my build on TeamCity broke

确定我已将MSBuild目标从我的PC复制到构建服务器:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet

我能够构建解决方案。

问题是:我无法发布它!

当我跑:MSBuild.exe Solution.sln /p:DeployOnBuild=true /p:publishprofile=local时,它会失败:

C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ DotNet \ Microsoft.DotNet.Publishing.targets(406,5):错误:发布期间发生错误。 [d:\路径\ project.xproj] C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ DotNet \ Microsoft.DotNet.Publishing.targets(406,5):错误:无法将参数绑定到参数'Path',因为它是一个空字符串。 [d:\路径\ project.xproj]

我用Visual Studio重新创建了发布配置文件(生成的powershell脚本与RC1不同)

发布在本地工作正常,我安装了Visual Studio。

问题是:

我需要添加到构建服务器,以便能够使用/p:DeployOnBuild=true /p:publishprofile= 运行MSBuild,而无需安装Visual Studio。

由于

1 个答案:

答案 0 :(得分:0)

我不会将此标记为答案,因为我仍然希望正确的答案,但是要帮助像我一样陷入困境的其他人:

到目前为止我做了什么:

project.json 得到了:

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

构建步骤是:

    解决方案目录上的
  1. dotnet restore
  2. msbuild解决方案
  3. dotnet发布在特定项目目录
  4. 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