我可以在没有安装 Visual Studio 的情况下在 Windows 服务器上构建 .NET Core 应用程序吗? [英] Can I build .NET Core applications on a Windows server without Visual Studio installed?

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

问题描述

在仅从 .net core 下载站点安装 .net core SDK 而没有安装 Visual Studio 之后,我正在尝试在 Windows 上设置一个构建 .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:devaaa.xproj(7,3): error MSB4019: The imported project 
 "C:Program Files (x86)MSBuildMicrosoftVisualStudiov14.0
 DNXMicrosoft.DNX.Props" was not found

我在谷歌上搜索并发现了有关早期测试版中此类错误的投诉,但我认为独立的 .net 核心工具应该仅适用于 Visual Studio 代码(或实际上任何编辑器)并且未安装 Visual Studio,只是.net core 独立 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.

推荐答案

是的,您可以在 Windows、Mac 和 Linux 上构建 .NET Core 应用程序,而无需安装 Visual Studio.

Yes, you can build .NET Core applications without Visual Studio installed, on Windows, Mac and Linux.

您需要为您的平台安装 .NET SDK.仔细检查您是否拥有最新版本:

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

dotnet --version
5.0.401

然后,进入您的项目目录(包含您的 .csproj 文件或 .sln 文件的文件夹)并运行:

Then, go into your project directory (the folder that contains your .csproj file, or a .sln file) and run:

dotnet build

或者,在发布模式下构建:

or, to build in Release mode:

dotnet build -c Release

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

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