是否可以在未安装Visual Studio的Windows服务器上构建.NET Core应用程序? [英] Can I build .NET Core applications on a Windows server without Visual Studio installed?

查看:92
本文介绍了是否可以在未安装Visual Studio的Windows服务器上构建.NET Core应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows上建立一个持续集成服务器,该服务器在从.net core下载站点仅安装.net core SDK而不安装Visual Studio的情况下,构建.net core应用程序。

I am trying to set up a continuous integration server that is on Windows, that builds .net core applications, after installing only the .net core SDK from the .net core download site, without installing Visual Studio.

尝试构建时遇到的错误是:

The error I get when I try to build is:

C:\dev\aaa.xproj(7,3): error MSB4019: The imported project 
 "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0
 \DNX\Microsoft.DNX.Props" was not found

我用Google搜索并发现了有关在早期的Beta中出现这种错误,但我认为独立的.net核心工具应该只能与Visual Studio代码(或实际上是任何编辑器)一起使用,而与未安装Visual Studio一起使用,只需。net核心独立sdk

I have googled and found complaints about this kind of error in earlier betas but I thought that the standalone .net core tools were supposed to work with just visual studio code (or indeed any editor) and with visual studio not installed, just the .net core standalone sdk.

是否有任何技术可以获取这个工作吗?有趣的是,当我从解决方案的根目录运行dotnet build时,发生了上述错误:

Is there any technique to get this to work? Interestingly the error above occurred when I ran dotnet build from the solution root directory, like this:

msbuild /v:q  /t:Build /nologo /P:Configuration=Release MySolutionWithSevenProjectsInIt.sln

以上似乎要求Visual Studio能够要安装它来构建整个解决方案,所以我猜测是否需要解决方案构建步骤而不是单个项目构建步骤,需要Visual Studio吗?

The above appears to require Visual Studio to be installed to build the whole solution, so I am guessing if I need a "solution build" step instead of an individual project build step, I need visual studio?

令我感到奇怪的是,该系统根本没有安装msbuild,这台计算机只具有.net核心sdk和不工作(如上所述)msbuild。

It's odd to me that this system has msbuild installed at all, all this computer has is the .net core sdk, and a "non working" (as above) msbuild.

推荐答案

是的,您可以在未安装Visual Studio的情况下构建.NET Core应用程序。 (我一直在Mac上做!)

Yes, you can build .NET Core applications without Visual Studio installed. (I've been doing it on my Mac!)

您需要。NET Core SDK 。仔细检查您是否拥有最新版本:

You need the .NET Core SDK installed for your platform. Double check that you have the latest version:

dotnet --version
2.0.2

然后,您可以进入项目目录(包含 .csproj 文件)并运行:

Then, you can go into your project directory (the folder that contains your .csproj file) and run:

dotnet build

或以发布模式构建:

dotnet build -c Release

这篇关于是否可以在未安装Visual Studio的Windows服务器上构建.NET Core应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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