I'm building a ASP.NET Core app which I can publish using dotnet publish
. So far, so good.
I'm interested in packaging that app so I can publish it on a NuGet server. dotnet pack
, however, doesn't seem to contain enough information to recreate the website on its own -- just the dll file.
Is there a way to create a NuGet package, through dotnet pack
or some other method, or do I need to manually package the files in the output directory myself?
NET (including . NET Core), the Microsoft-supported mechanism for sharing code is NuGet, which defines how packages for . NET are created, hosted, and consumed, and provides the tools for each of those roles.
NuGet is a powerful ecosystem of tools and services. It was introduced in 2010 as an open source package manager for the Microsoft development platform including . NET. NuGet is the easiest way to improve and automate your development practices.
You can manually configure packOptions
setting in project.json
file to contain folders/files that you need, for example
"packOptions": {
"files": {
"include": [ "wwwroot/**.*", "Views/**.*" ] --add anything else that you need in here
}
}
Then run
dotnet pack
This worked for me. The package now contains images, js files etc.
As of 1/2017, there's no way one step way to do this, though ASP.NET Core is so fresh at the moment that I'm still hoping for a newer and better answer.
The best way to create a single file package for a ASP.NET Core website is to publish your app using dotnet publish
, and package the directory using a ZIP utility (or Octo.exe if you need a 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 which requires a manifest or project file to work, and dotnet pack
will only pack up the source files, and not assets (see the answer below for ways around that).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With