Warren  P Warren P - 1 year ago 352
C# Question

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 Worklist-Services.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.

Answer Source

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

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

λ dotnet --version

(At the time of writing, 1.0.0-preview2-003121 is the latest)

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

dotnet build

or, to build in Release mode:

dotnet build -c Release
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download