Building a C# library with msbuild and using project.json to manage nuget dependencies

150 views Asked by At

So, I've been wrestling with this issue so perhaps somebody can shed some light. I'm creating a .Net library and it's going to pull in another library via NuGet. I've learned there are three patterns for specifying the Nuget dependencies depending on the version of stuff: packages.config, project.json and Package References in the csproj file. We're using VS2015, so the last one is not an option. I'm thinking I should go with project.json, but having issues building the library on the Jenkins server.

So, if I use packages.config I can get everything to work. On my Jenkins server I issue a "nuget restore" and it pulls all the packages into the packages folder.

If I use project.json (which support the wildcard syntax I'd like to use), the "nuget restore" pulls down the package and places it into a cache. When msbuild runs, it can't find the libraries that nuget just pulled down. When running inside of VisualStudio, there is a target for ResolveNuGetPackageAssets that get run, but I can't see it being run with the msbuild process.

Any thoughts on the right way to build project with msbuild when they reference nuget packages with project.json?

Thanks in advance for any help you can offer.

0

There are 0 answers