1

There is a library build with .net framework 4.5, it serves as a NuGet package for other projects to reference.

In the testing phase, using the project reference method, it can work normally. However, after publishing it as NuGet, the project referenced using NuGet cannot work properly.

I tried to check the version of this library in the Bin directory, but found that it was the last version. I made sure to use the correct version in the NuGet package.

When I use the correct version of the dll to overwrite the class library copied from NuGet to the Bin directory, it still fails to work correctly.

What could be the reason for this?

Generated using Google Translate.

lljxww
  • 23
  • 4
  • How are you trying to reference the DLL? Can you please post some code? – rhughes Dec 21 '20 at 02:01
  • Can you add the error messages you get – stuartd Dec 21 '20 at 02:02
  • When the project runs normally, my reference method is to use "Add Reference -> Project" in Visual Studio; when the project runs abnormally, the reference method used is to package the target package as a NuGet package, and use NuGet to reference. @rhughes – lljxww Dec 21 '20 at 02:08
  • In fact, I think the error message is meaningless, or that the package I referenced does not work in the expected mode, but works like the previous version of this package. It is probably a version conflict or confusion problem. But the strange thing is Under the premise of using the NuGet package, when I manually copy the correct version of the package to the Bin directory of the application, it still does not work. @stuartd – lljxww Dec 21 '20 at 02:09
  • My class library version is 4.2.10. Use this version to package as a NuGet package, open it through NuGet Package Explorer, and confirm that the version number is correct; when I reference this package in other projects and build the project, I found this class library in the Bin directory The version is 4.2.8. – lljxww Dec 21 '20 at 02:13
  • In Visual Studio, what is the `Default package management format`? Tools => Options => NuGet Package Manager = General => Package Management => Default package management format ? When you add the file(s) are you setting "Copy Local: True" for each file (View => Properties Window; View => Solution Explorer => => References => . Click . In Properties window, `Copy Local: True`. Have you set `Specific Version: True`? – Tu deschizi eu inchid Dec 21 '20 at 03:39
  • `Default package management format`: packages.config `Copy Local`: True `Specific Version`: True – lljxww Dec 21 '20 at 07:00

0 Answers0