I have a console .net core app.
It references a few nuget packages.
Now that it's ready to deploy, when i'm building to release, the nuget references are not coming along so i'm getting a bunch of file not found...
how can i fix this?
You don't have to run dotnet restore because it's run implicitly by all commands that require a restore to occur, such as dotnet new , dotnet build , dotnet run , dotnet test , dotnet publish , and dotnet pack . To disable implicit restore, use the --no-restore option.
NET Core 2.0 and later dotnet build and dotnet run commands restore packages automatically. As of NuGet 4.0, dotnet restore runs the same code as nuget restore . To restore a package with dotnet restore : Open a command line and switch to the directory that contains your project file.
The dotnet publish command accepts MSBuild options, such as -p for setting properties and -l to define a logger. For example, you can set an MSBuild property by using the format: -p:<NAME>=<VALUE> .
deps. json will mean the host will blindly enumerate all . dll files in the application directory and use those as the "entire app". This typically means: Portable apps may not work (building with no RID specified will produce a portable app)
It's the difference between building (for testing) and publishing (for deployment to production). dotnet build
will build your application for local testing and usage. It will assume that nuget dependencies are present on the machine. If you want to build for deployment, use dotnet publish
instead:
dotnet publish -c Release
Then look into the ./bin/Release/netcoreapp2.0/publish
directory. It should contain all your dependencies too.
See https://docs.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli for more details.
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