Deploying a .NET App with Nuget Dependencies
-
When creating a .NET Framework 4.7.2 class library that uses a lot of Microsoft's NuGet packages, and creating an internal NuGet package from the library, is there a way to wrap all those MS packages into the library so that they aren't all required in apps built using my library? Background: I've got a legacy .NET Framework 4.7.2 console app, initially deployed a few years ago to an app server using a setup project. Updates and enhancements were deployed by merely copying the exe to the installation location, as well as any new DLLs the enhancements required. We recently decided to have all our internal applications write their logs to Application Insights in Azure, so I created a .NET Framework 4.7.2 class library with this functionality, and added the 20-odd NuGet packages required (this overhead is insane) to support writing to AI. I built my own NuGet package for this library, uploaded it to our DevOps Artifacts. Then I added my package to the legacy app, and when I built the app it added all those MS DLLs to the obj/Release folder. I copied the new DLLs and the new exe to the deployed folder on the server, but running it fails as it can't find the MS DLLs. Setup projects are no longer supported (why???), so I don't know how to get this to work. Any ideas?
If you think 'goto' is evil, try writing an Assembly program without JMP.
-
When creating a .NET Framework 4.7.2 class library that uses a lot of Microsoft's NuGet packages, and creating an internal NuGet package from the library, is there a way to wrap all those MS packages into the library so that they aren't all required in apps built using my library? Background: I've got a legacy .NET Framework 4.7.2 console app, initially deployed a few years ago to an app server using a setup project. Updates and enhancements were deployed by merely copying the exe to the installation location, as well as any new DLLs the enhancements required. We recently decided to have all our internal applications write their logs to Application Insights in Azure, so I created a .NET Framework 4.7.2 class library with this functionality, and added the 20-odd NuGet packages required (this overhead is insane) to support writing to AI. I built my own NuGet package for this library, uploaded it to our DevOps Artifacts. Then I added my package to the legacy app, and when I built the app it added all those MS DLLs to the obj/Release folder. I copied the new DLLs and the new exe to the deployed folder on the server, but running it fails as it can't find the MS DLLs. Setup projects are no longer supported (why???), so I don't know how to get this to work. Any ideas?
If you think 'goto' is evil, try writing an Assembly program without JMP.
Would have stuck with the EXE. Create a (web) server for handling the logging to Azure; your apps talk to the server instead of "NuGet", etc.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
When creating a .NET Framework 4.7.2 class library that uses a lot of Microsoft's NuGet packages, and creating an internal NuGet package from the library, is there a way to wrap all those MS packages into the library so that they aren't all required in apps built using my library? Background: I've got a legacy .NET Framework 4.7.2 console app, initially deployed a few years ago to an app server using a setup project. Updates and enhancements were deployed by merely copying the exe to the installation location, as well as any new DLLs the enhancements required. We recently decided to have all our internal applications write their logs to Application Insights in Azure, so I created a .NET Framework 4.7.2 class library with this functionality, and added the 20-odd NuGet packages required (this overhead is insane) to support writing to AI. I built my own NuGet package for this library, uploaded it to our DevOps Artifacts. Then I added my package to the legacy app, and when I built the app it added all those MS DLLs to the obj/Release folder. I copied the new DLLs and the new exe to the deployed folder on the server, but running it fails as it can't find the MS DLLs. Setup projects are no longer supported (why???), so I don't know how to get this to work. Any ideas?
If you think 'goto' is evil, try writing an Assembly program without JMP.
TNCaver wrote:
running it fails as it can't find the MS DLLs
That's the problem you need to fix, but unfortunately you haven't provided enough information about it. You need to get the full exception details to try to diagnose the problem.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
TNCaver wrote:
running it fails as it can't find the MS DLLs
That's the problem you need to fix, but unfortunately you haven't provided enough information about it. You need to get the full exception details to try to diagnose the problem.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
If you think 'goto' is evil, try writing an Assembly program without JMP.
-
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
If you think 'goto' is evil, try writing an Assembly program without JMP.
Double-check that the folder your app is running from contains
Microsoft.Extensions.DependencyInjection.Abstractions.dll
, and that its version is precisely5.0.0.0
. v5 of that library[^] doesn't have any additional dependencies, so either the file is missing, or you've got the wrong version.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Double-check that the folder your app is running from contains
Microsoft.Extensions.DependencyInjection.Abstractions.dll
, and that its version is precisely5.0.0.0
. v5 of that library[^] doesn't have any additional dependencies, so either the file is missing, or you've got the wrong version.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Yep, did that at the beginning of my troubleshooting. All 20 package DLLs are in the same folder as the exe, just as all the previous DLLs it has been using all along have been. All the correct versions, copied from the obj\x64\Release folder where they were pushed to when I built the project.
If you think 'goto' is evil, try writing an Assembly program without JMP.