无法在构建服务器上发布 ASP.NET Core 1.0 RC2 应用程序 [英] Can't publish ASP.NET Core 1.0 RC2 Application on build server

查看:17
本文介绍了无法在构建服务器上发布 ASP.NET Core 1.0 RC2 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在构建服务器上没有 Visual Studio.从 DNX (RC1) 迁移到 .NET 之后核心 CLI (RC2) 我在 TeamCity 上的构建失败了.

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)MSBuildMicrosoftVisualStudiov14.0DotNet

我能够构建解决方案.

问题是:我不能发布它!

当我运行: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)MSBuildMicrosoftVisualStudiov14.0DotNetMicrosoft.DotNet.Publishing.targets(406,5): error : 发布期间发生错误.[d:pathproject.xproj]C:Program Files (x86)MSBuildMicrosoftVisualStudiov14.0DotNetMicrosoft.DotNet.Publishing.targets(406,5): 错误:无法将参数绑定到参数路径",因为它是一个空字符串.[d:pathproject.xproj]

C:Program Files (x86)MSBuildMicrosoftVisualStudiov14.0DotNetMicrosoft.DotNet.Publishing.targets(406,5): error : An error occurred during publish. [d:pathproject.xproj] C:Program Files (x86)MSBuildMicrosoftVisualStudiov14.0DotNetMicrosoft.DotNet.Publishing.targets(406,5): error : Cannot bind argument to parameter 'Path' because it is an empty string. [d:pathproject.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= 的 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.

谢谢

推荐答案

我不会将此标记为答案,因为我仍然希望 正确 答案,而是帮助其他得到像我一样卡住:

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:

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 在特定项目目录上
  1. dotnet restore on the solution directory
  2. msbuild solution
  3. dotnet publish on the specific project directory

例如:

d:projectProject.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:projectProject.BlainRelease
et452win7-x64publish'
Updating web.config at 'd:projectProject.BlainRelease
et452win7-x64publishweb.config'
Configuring project completed successfully
publish: Published to d:projectProject.BlainRelease
et452win7-x64publish
Published 1/1 projects successfully

这篇关于无法在构建服务器上发布 ASP.NET Core 1.0 RC2 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆