Muhammad Rehan Saeed
Muhammad Rehan Saeed

Reputation: 38477

Build Class Library (Package) NuGet Package Projects Without Visual Studio

What do I need to do to build the new 'Class Library (Package)' (.xproj) projects (also used by ASP.NET 5) using MSBUILD without having Visual Studio installed? I currently get the error below:

C:\Source\MyProject.xproj(7,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\DNX\Microsoft.DNX.Props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

I am only targeting .NET 4.5.2, I have the Microsoft Build Tools 2015 already installed and want to do this on my build server.

UPDATE

It seems I can do a dnu publish to achieve this but that is only for a single .xproj project. What about if I want to publish several projects in a solution for my build environment? Adding projects individually is not very convenient.

Doing MSBUILD MySolution.sln would do this for standard class libraries. Is there a way to get MSBUILD MySolution.sln to work for this case?

Upvotes: 1

Views: 687

Answers (4)

Stafford Williams
Stafford Williams

Reputation: 9806

Check dnvm list to ensure the version you intend to build with matches what your projects target. If it doesn't, use dnvm use to set it or dnvm install to install it.

Then cd /your/solution/direcotry and;

dnu restore
dnu build *

Upvotes: 0

Victor Hurdugaci
Victor Hurdugaci

Reputation: 28425

Why do you need msbuild?

All you need is dnvm so you can acquire a dnx. After that you can run dnu pack and produce the packages.

Upvotes: 1

Kiran
Kiran

Reputation: 57979

You can use dnu pack to create a nuget package. Type dnu pack --help for more info

Upvotes: 1

Thom Kiesewetter
Thom Kiesewetter

Reputation: 7324

Try using dnu build. (VS2015 also using this) All aspnet repro's can be build with the build.cmd without VS2015.

For an example see asp live or datatables

Upvotes: 1

Related Questions