在构建服务器上构建 .NET Core 1.0 RC2 应用程序

Building .NET Core 1.0 RC2 app on the build server

我已将我的应用程序从 DNX ASP.NET 5 RC1 更新到 ASP.NET Core 1.0 RC2。 它在本地构建并运行良好。

在构建服务器上,我没有安装 Visual Studio,构建失败并显示:

error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

我确实安装了:.NET Core SDK for Windows。 尝试安装 VS 2015 工具预览失败:

无需安装 Visual Studio 2015 即可在构建服务器上构建 .NET Core 1.0 RC2 应用程序的正确设置是什么?

注意:构建框 (TeamCity 9) builds/runs 测试适用于 .NET 4.5 和 DNX。

我现在可以构建 解决方案。 Still can't publish though.

我刚刚将所有新的 MSBuild 内容复制到生成服务器。我复制了:

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

从我的本地计算机到构建服务器。这包括新的 DotNet 子文件夹,其中包含:

Microsoft.DotNet.Common.targets
Microsoft.DotNet.Extensions.targets
Microsoft.DotNet.props
Microsoft.DotNet.Publishing.targets
Microsoft.DotNet.targets
Microsoft.DotNet.Tasks.dll
Microsoft.VisualStudio.ProjectSystem.DotNet.Runtime.dll
Newtonsoft.Json.dll

我可以构建解决方案(没有发布参数)当我尝试时它失败了:

MSBuild.exe Solution.sln /p:DeployOnBuild=true /p:publishprofile=local

您可以通过命令行构建和测试项目 - 因此无需安装 Visual Studio。通过使用 "Command Line" 类型的构建步骤,您可以 运行:dotnet restore、dotnet build、dotnet test

在这里您可以找到一些描述如何 运行 作为 TFS 的构建。它是为托管的 TFS 编写的,但也可以在本地工作(并且不仅适用于 azure,正如文档名称可能暗示的那样): https://www.visualstudio.com/en-us/docs/build/apps/aspnet/aspnetcore-to-azure

对于发布,我将 msdeploy 与 RC1 一起使用,但尚未迁移我的部署版本。当这在接下来的几天内完成时,我可能会在这里记录它。

https://docs.microsoft.com/en-us/dotnet/articles/core/windows-prerequisites#issues

问题 由于临时错误,您可能无法为 Visual Studio 2015 安装程序安装 .NET Core Tooling Preview 2。要解决此问题,运行 使用 SKIP_VSU_CHECK=1 参数从命令行安装程序,如下例所示。

DotNetCore.1.0.0-VS2015Tools.Preview2.exe SKIP_VSU_CHECK=1

所以没有 Visual Studio 或 Web Deploy,我的 TeamCity 构建由 4 个构建步骤组成:

dotnet restore
dotnet build
dotnet test
dotnet publish -c Release

我 运行 有一个基本的 for 循环。