Why is ServiceStack.Text not being copied to Bin?

I added ServiceStack.Redis via Nuget to the assembly I have. This package has a dependency on ServiceStack.Common, which has a dependency on ServiceStack.Text

This project refers to my web project, but when I create a Website and load it into my browser, I get an error

Failed to load file or assembly "ServiceStack.Text, Version = 3.9.24.0, Culture = neutral, PublicKeyToken = null" or one of its dependencies. The system cannot find the specified file.

Of course, when I go to the Bin directory of my site, it is not there. Oddly enough, if I go to the Bin directory of the class library to which I refer (the one to which I pulled the Nuget package), it is.

Repeat

  • Classlibrary
    • ServiceStack.Redis via Nuget (includes ServiceStack.Common and ServiceStack.Text)
    • They all do it in the bin directory when creating
  • Web proj
    • Refs ClassLibrary
    • all dependencies are transferred to Bin except ServiceStack.Text

I'm at a dead end. Does anyone know why?

Note. The error seems to be looking for version 3.9. 24 , but the Nuget pull version is 3.9. 26 . If I translate it to Web / Bin manually, it works, although

+7
source share
3 answers

Check the assembly reference properties in your .csproj files, maybe they still reference an older version of ServiceStack.Text. Sometimes I find that NuGet at some point will not work during a package update and leave the assembly links in poor condition. For example, your packages.config file may correctly show that all ServiceStack links have the same version number, but your .csproj file can link to 3.9.24 for ServiceStack.Common and 3.9.26 for ServiceStack.Text . Thus, it copies the various versions of these assemblies into your bin directory. It can probably be generated successfully because you have an old copy of ServiceStack.Common cached in your NuGet package directories.

I will fix this by manually editing the .csproj file to have the correct build path and version number, or by removing and reinstalling the affected packages via NuGet (this will probably require reinstalling most / all ServiceStack packages with ServiceStack. Text is such a low dependency.

+1
source

I had this somewhat bizarre issue in several versions of Visual Studio, atm 2013. This happened by accident.

I also have dependencies on ServiceStack.Common, which implicitly depends on ServiceStack.Text. However, I do not go anywhere, referring to any class, structure, etc. Inside the binary file ServiceStack.Text.

Even if you install

Copy Local = true

ServiceStack.Text.dll is not copied to the output folder.

I have experienced this with numerous versions of the ServiceStack dll, currently v4.0.15. Could this be a more general Visual Studio error regarding deadlock dependency chains in unused libraries? ServiceStack.Text is probably flagged as a dependency in other ServiceStack dlls, but Visual Studio tries to outsmart it by seeing that the library can be excluded (I'm just thinking).

In any case, I solved this by simply using ServiceStack.Text directly in a private method, placed in an arbitrary file in my own library:

 /// <summary> /// Needed because of Visual Studio bug? Don't use this method. /// </summary> private JsonValue DontDoIt() { return new ServiceStack.Text.JsonValue(); } 

I would expect the compiler to exclude an unused private method - indeed, this probably happens in the IL code, but nevertheless this leads to VS copying the dll to the output directory.

+1
source

As esker explains, upgrading may cause problems with Nuget, but there are also problems with ServiceStack Nuget packages.

The latest package working for today is 3.9.60. ServiceStack.Text.dll is really 3.9.60.

ServiceStack 3.9.61 and later has ServiceStack.Text.dll version 3.9.59.

The problem with the copy appears again.

0
source

All Articles