简体   繁体   English

.Net Core - 构建到发布不会复制NUGET依赖项

[英].Net Core - Building to release does not copy NUGET dependencies

I have a console .net core app. 我有一个控制台.net核心应用程序。
It references a few nuget packages. 它引用了一些nuget包。
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... 现在它已经准备好部署,当我正在构建发布时,nuget引用不会出现所以我得到一堆文件未找到...

how can i fix this? 我怎样才能解决这个问题?

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. dotnet build将构建您的应用程序以进行本地测试和使用。 It will assume that nuget dependencies are present on the machine. 它将假设机器上存在nuget依赖性。 If you want to build for deployment, use dotnet publish instead: 如果要构建部署,请改用dotnet publish

dotnet publish -c Release

Then look into the ./bin/Release/netcoreapp2.0/publish directory. 然后查看./bin/Release/netcoreapp2.0/publish目录。 It should contain all your dependencies too. 它应该包含所有依赖项。

See https://docs.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli for more details. 有关详细信息,请参阅https://docs.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM