If I try to use the JsonServiceClient of Servicestack I always get the following Exception:
Could not load file or assembly 'ServiceStack.Text, Version=4.0.14.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies.
System cannot find the file specified.":"ServiceStack.Text,
Version=4.0.14.0, Culture=neutral, PublicKeyToken=null
The project runs with .net 4.5 and the Servicestack Version 4.0.15.0. That ist the weirdest thing, because I never had 4.0.14.0 as a reference. I only have a reference to Servicestack.Text 4.0.15.0 and all the other ServiceStack libs in 4.0.15.0
Before I had the same Problem with 3.9.66.0 expecting 3.9.63. But I upgraded via NuGet hoping to solve the Problem but it didn't work.
I just noticed in my Outputfolder that Servicestack.Text was missing. Now I use a direct call to a class in Servicestack.Text and the compiler isn't optimising Servicestack.Text out.
Related
Using Visual Studio 16.6, migrating WPF app to target .netcore3.1(.300). Cannot compile with error below:
Error MC1000 Unknown build error, 'Could not find assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly.' MyApp C:\Program Files\dotnet\sdk\3.1.300\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets 225
I don't seem to have any need or reference for System.Web
I see similar things here but am on current versions:
https://github.com/dotnet/wpf/issues/2648
Any ideas?
There seemed to be an issue with the structure of the project file. I don't reference System.Web but a third party DevExpress component does.
When you target .netcoreapp31 AND net472, the Nuget packages do not seem to get pointed to the target frameworks correctly. The project file needed to be manually restructured to point them to the correct frameworks.
Details here:
Issue on github dotnet/wpf
I am refering a C# library project from my Azure Function (Service bus queue trigger). The library is referencing the Newtonsoft nuget version 10.0.1.
While running the function locally on my visual studio, it gives this error .
{"Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.":"Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed"}
I tried downgrading to version 10.0.0, but the issue is there.
I stumbled upon this issue link : https://github.com/Azure/azure-functions-vs-build-sdk/issues/107.
And tried downgrading to 9.0.1. But even then the error still occurs.
Note: The library project reference several other library projects which are also referencing Newtonsoft. I am keeping the same version of the nuget all the sub projects.
How to solve this issue?
Pointing all the Newtonsoft dlls in all the sub libraries to version to 9.0.1 solved the issue.
I have a class that implements IXMLSerializable in a .NET Standard Library, but I can't compile the library because it's referencing IXMLSerializable in two places. The output is as follows:
error CS0433: The type 'IXmlSerializable' exists in both
'System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' and 'System.Xml.XmlSerializer,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I only see one reference under the dependencies though (System.Xml.XmlSerializer), which I need for the XML attributes. This is my first crack at a .Net Standard Library, so is there something I'm missing here?
Try upgrading your reference to System.Xml.XmlSerializer to version 4.1.0.0.
The error message says that you have two references to the library, but are using different versions. System.Xml.ReaderWriter is using a newer version than your project is, so you need to get that version.
You could also try removing your reference to System.Xml.XmlSerializer or switching it to an older version.
I have recently made the decision to try and re-standardise my older style PCL's from the (apparently archaic) old approach of portable-net451+win81+wpa81 to now netstandard1.x. I took this decision as Xamarin Forms on my Mac was no longer recognising one of my libraries as a NuGet package.
Anyway, having started this conversion I have entered a world of unknown pain in the sense that it isn't a very automatic process. I'm now at the stage where I think I've converted my PCL's to net standard libraries but now I'm trying to reference these standards within a 'normal' windows console app I get odd errors.
Primarily my errors are thus:
Error CS0012: The type System.Linq.IQueryable 1<TItem> is defined in an assembly that is not referenced. Consider adding a reference to assembly System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (CS0012)
Error CS0012: The type System.Collections.IEnumerable is defined in an assembly that is not referenced. Consider adding a reference to assembly System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (CS0012) (Redbridge.Console)
Now given that my project is referencing one of my net standard libraries and this error originates from me using a class that requires packages System.Linq.Queryable and System.Linq to be added specifically to my net standard library I can't help but wonder how I'm meant to make this work in my console app library. I note that the versions are .20 rather than the standard .0 so what do I do to make this work?
I've tried the obvious (referencing the above packages in my console app as suggested by the compiler) but to no effect. Does anyone have any advice? Do I need to add a project.json file for example to my console app so that I can indicate that .NET standard should be used or something?
I've read quite a bit on the .NET standard and like most find it confusing as to what I'm expected to do.
I have a webpart for SharePoint 2010 written on ASP.Net and I need to use JSON.Net. So I Nugeted Json.NET version 4.5.9. Then problem happens:
Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. Couldn't locate file.
What should I do?
I had same kind of problem once.
Don't use earlier references.
If you have any, remove them and add Json.Net once again using Nuget.
Install-Package Newtonsoft.Json
It solved for me.