8

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?

Leonardo
  • 10,737
  • 10
  • 62
  • 155

1 Answers1

13

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://learn.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli for more details.

omajid
  • 14,165
  • 4
  • 47
  • 64