Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I build .NET Core applications on a Windows server without Visual Studio installed?

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

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.

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

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?

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.

like image 851
Warren P Avatar asked Aug 04 '16 17:08

Warren P


1 Answers

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

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

dotnet --version
5.0.401

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
like image 59
Nate Barbettini Avatar answered Oct 01 '22 09:10

Nate Barbettini