How to use NuGet packages with an ASP.NET website on a CI server

I have several ASP.NET Web Form websites (one that doesn't have a .csproj file), and I'm trying to figure out how best to use NuGet packages with them. When using Visual Studio 2015, adding NuGet packages through the user interface works correctly (there is a package.config file in the root of the site), and the assembly drops binary files in the bin folder.

The problem is trying to build a TeamCity project through MSBuild. For other projects, I can use NuGet.exe with the restore command (either against csproj or the sln file), and the packages load correctly and are included in the output. However, this does not work with websites, and therefore, compilation fails due to a lack of files.

As a last resort, I could write my own script / build step to manually copy the assemblies to the bin folder, but I would like to avoid this. Am I missing something? Can I use NuGet with websites outside of Visual Studio?

+4
source share
1 answer

After some time, I have a workaround that helps me where I need to be, although not in the best way.

In new versions of Visual Studio, when a binary dependency is added to the site via VS, it adds the file (dinary.refresh) to the bin file along with the binary file. The contents of the file is the relative path to the .dll through the package folder for the solution. In addition, the package.config file is added to the site.

CI:

  • (.gitignore,.hgignore) - -
  • .refresh bin
  • NuGet restore, - package.config PackagesDirectory ( SolutionDirectory)
  • , MSBuild , .

, NuGet ( , ), . , .refresh, 2015 . NuGet, /packages.configs .

, Erick

+1

Source: https://habr.com/ru/post/1609218/


All Articles