【问题标题】:Can't publish ASP.NET Core 1.0 RC2 Application on build server无法在构建服务器上发布 ASP.NET Core 1.0 RC2 应用程序
【发布时间】:2016-09-20 14:37:08
【问题描述】:

我在构建服务器上没有 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): error : 发布时出错。 [d:\path\project.xproj] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing.targets(406,5):错误:无法将参数绑定到参数“路径”,因为它是一个空字符串. [d:\path\project.xproj]

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

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

问题是:

我需要向构建服务器添加什么,才能使用/p:DeployOnBuild=true /p:publishprofile= 运行 MSBuild,而无需安装 Visual Studio。

谢谢

【问题讨论】:

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


    【解决方案1】:

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

    到目前为止我做了什么:

    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 publish 在具体项目目录上

    例如:

    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
    

    【讨论】:

      猜你喜欢
      • 2016-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-24
      • 1970-01-01
      相关资源
      最近更新 更多