Is there a way to package an ASP.NET Core application using NuGet or otherwise?

I am creating an ASP.NET Core application that can be published using dotnet publish . So far so good.

I am interested in packing this application so that I can publish it on a NuGet server. dotnet pack , however, does not seem to contain enough information to recreate the site on its own - just a dll file.

Is there a way to create a NuGet package via dotnet pack or some other method, or do I need to manually manually package the files in the output directory?

+5
source share
2 answers

As of 1/2017, there is no way to do this, although ASP.NET Core is so fresh at that moment that I still hope for a newer and better answer.

The best way to create a single package of files for the ASP.NET Core website is to publish your application using dotnet publish and package the directory using the ZIP utility (or Octo.exe if you need the NuGet package for Octopus).

Current tools as of 2017/1: Octopack, which uses NuGet, cannot package .NET Core projects. NuGet itself is a minimal tool that requires a manifest or project file, and dotnet pack will only pack source files, not assets (see answer below for ways around this).

+4
source

You can manually configure packOptions in the project.json file to contain the folders / files you need, e.g.

       "packOptions": {
         "files": {
           "include": ["wwwroot /**.*", "Views /**.*"] - add anything else that you need in here
         }
       }

Then run

  dotnet pack 

It worked for me. The package now contains images, js files, etc.

+3
source

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


All Articles