Core项目构建解决方案

Core项目构建解决方案

本文介绍了在构建服务器上使用ASP.NET Core项目构建解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个项目的.sln解决方案,全部用于.NET Framework 4.6,而.NET Core没有.现在,我使用ASP.NET Core添加了一个新的Web项目,但仍以.NET Framework 4.6为目标.基于PowerShell的构建脚本包括一个NuGet软件包还原,其调用方式如下:

I have a .sln solution of multiple projects, all for the .NET Framework 4.6, nothing with .NET Core. Now I've added a new web project using ASP.NET Core, still targeting the .NET Framework 4.6. The PowerShell-based build script includes a NuGet package restore that is called like this:

nuget.exe restore $solutionFile -NonInteractive

此操作失败,并显示以下消息:

This fails with the following message:

MSBuild的支持文件似乎丢失了.但是我无法安装ASP.NET Core工具,因为它们坚持要求在构建服务器上安装完整的Visual Studio 2015 IDE,这太疯狂了,我也不想这样做.可以安装其他所有东西,以最小的占用空间,构建工具和框架.

A support file of MSBuild seems to be missing. I can't install the ASP.NET Core tools however because they insist on requiring the full Visual Studio 2015 IDE installed on the build server which is insane and I don't want to do that. Everything else can be installed for minimal footprint, the build tools and the framework.

如果我遗漏了NuGet软件包还原,则显然会由于缺少程序集而导致构建失败.

If I leave out the NuGet package restore, the build fails because the assemblies are missing, obviously.

如何在没有完整的VS IDE的情况下安装对ASP.NET Core 1.0 RTM的MSBuild支持?

How can I install MSBuild support for ASP.NET Core 1.0 RTM without the full VS IDE?

更新:我将两个目录DotNetDotNet.Web从C:\ Program Files(x86)\ MSBuild \ VisualStudio \ v14.0复制到了构建服务器计算机. NuGet软件包还原可以正常工作,但是构建失败,并为许多项目显示以下消息:

Update: I copied the two directories DotNet and DotNet.Web from C:\Program Files (x86)\MSBuild\VisualStudio\v14.0 to the build server machine. NuGet package restore worked then, but the build fails with the following message for a number of projects:

大致翻译为项目中不存在目标'_GenerateDependencyFragmentJson'." Google甚至都不知道这个词.

Roughly translates as "The target '_GenerateDependencyFragmentJson' does not exist in the project." Google does not even know that word.

我知道,将文件从一台机器盲目复制到另一台机器不是一件好事,而且我没想到这会起作用.至少它会产生以后的错误消息.

I am aware that blindly copying files from one machine to another is not a good thing to do, and I didn't expect this to work. At least it produces later error messages.

推荐答案

虽然这可能不是我原始问题的答案,但这是对该问题的(不愉快的)答案.

While this may not be the answer to my original question, it is an (unpleasant) answer to the problem.

在构建服务器(代理)上安装完整的Visual Studio 2015.这包括处理这些项目所需的一切,就像在您的开发机器上一样.它只需要9 GB的磁盘空间和一个单独的许可证,但是,嘿,他说这会很方便.

Install the full Visual Studio 2015 on the build server (agent). This comes with everything that's required to deal with these projects, just like on your development machine. It just requires 9 GB of disk space and a separate licence, but hey, who said it would be convenient.

这篇关于在构建服务器上使用ASP.NET Core项目构建解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 02:02