On running a windows phone project in VS 2012, I was getting this error:
{System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
File name: 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
at MobileConnection.SSCClient.SSCConnection.GetHostNameAndPort()
at MobileConnection.SSCClient.SSCConnection.InitializeSSCConnection(Boolean runningState)}
The corresponding entries in .csproj file is:
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\sl4-windowsphone71\Newtonsoft.Json.dll</HintPath>
</Reference>
And, in packages.config:
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="wp80" />
I debugged it for a while, re-installed the newtonsoft.json package through nuget.
But the solution that worked for me is setting the 'private' property to 'True'.
Updated entry in .csproj file:
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\sl4-windowsphone71\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
I am not able to understand how it worked or what the issue was. The description on msdn documentation didn't help much either http://msdn.microsoft.com/en-us/library/vstudio/bb629388.aspx.
When running the program, it pulls in dlls from the output directory. Originally, Newtonsoft.Json wasn't being copied to the output directory, but by specifying Private to True, you told Visual Studio to copy the Newtonsoft.Json dll to the output folder along with your program.
For completeness, the documentation on Private:
Optional boolean. Specifies whether the reference should be copied to the output folder. This attribute matches the Copy Local property of the reference that's in the Visual Studio IDE.
Related
Im having an issue when upgrading Telerik references in a VS2019 C# project. Current version is 9.0.* and upgrade version is 16.1.*.
In the .csproj with the current version the reference is defined this way
**<Reference Include="Telerik.Reporting">
<HintPath>..\dll\External\Telerik.Reporting.dll</HintPath>
<SpecificVersion>False</SpecificVersion>**
If i update the reference from add reference->assemblies->extensions the .csproj code looks like this, and its ok:
**<Reference Include="Telerik.Reporting, Version=16.1.22.622, Culture=neutral, PublicKeyToken=a9d7983dfcc261be, processorArchitecture=MSIL" />**
But here comes the issue. I have to do a local copy inside my project of the telerik.reporting.dll. So I pick the C:\Program Files (x86)\Progress\Telerik Reporting R2 2022\Bin\Telerik.Reporting.dll and copy it inside my C:\GIT\MySolution\dll\external folder.
Once i have the file copied i update the reference from add reference->browse. And then the .csproj looks like this
**<Reference Include="Telerik.Reporting, Version=9.0.15.225, Culture=neutral, PublicKeyToken=a9d7983dfcc261be, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dll\External\Telerik.Reporting.dll</HintPath>
</Reference>**
The version of the telerik.reporting.dll in my external folder is 16.1.* but somehow the .csproj code now shows the 9.0.* and dont now why.
Thanks for your help.
I'm not sure why am I getting this error now. I referenced an assembly out of Nuget package that is in turn referenced in packages.config file.
This is how the assembly is referenced in my csproj file:
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
</Reference>
I tried to delete the reference in VS and re-reference it again from packages folder without any luck.
Following article mentiones GAC and appbase, but I'm not sure how to find those paths any why the compiler would even look there if the correct file is referenced in my csproj?
The located assembly’s manifest definition with name xxx.dll does not match the assembly reference
One more place to check was Web.config. As soon as version conflict was fixed there everything worked.
3 places to check for reference conflicts are:
*.csproj
packages.config
Web.config
I have an assembly that is registered in GAC. In 'Windows/assembly' folder I can see it and also see its PublicKeyToken 'aaaa'. I have a SSIS solution (I think no matter at all what is the type of solution).
SSIS package has many c# scripts, each of them has its own references. Some of them contains reference for my assembly. I see the same path to the assembly in properties for it in each script. BUT one of the scripts has another PublicKeyToken 'bbbb' (the others have 'aaaa'). And it breaks the whole solution. Build works good, but Run fails. How can I manage such situation?
Update: issue appeared after new version of assembly has been added to the GAC. the old one has been deleted.
I tryed to change reference for a copy of dll but the problem doesn't go away. Maybe is there any way to set PublicKeyToken? I've even tryed to change compiled file (but what if? =))
In .dtsx file (file for compiled package) it looks like:
for one script:
<Reference Include="MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bbbb, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\assembly.dll</HintPath>
</Reference>
for the others:
<Reference Include="MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=aaaa, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\assembly.dll</HintPath>
</Reference>
Hello i am working on windows universal platform app in this app
the error is occured when i Debug my windows universal project this error comes automatically so any one suggest me how resolve this error?
Error : - Cannot find type System.MarshalByRefObject in module CommonLanguageRuntimeLibrary
so suggest me how to resolve this error.
I have resolved this error while removing System.Drawing reference from Windows 10 Universal app project.
As on search Ctrl+F all keyword system.drawling not found in solution. because this reference only added to project and not in use. so checked in project file .csproj which find it. and remove this reference.
<ItemGroup>
<Reference Include="DocumentFormat.OpenXml">
<HintPath>..\JOIN8POS.Website\SharedDLL\DocumentFormat.OpenXml.dll</HintPath>
</Reference>
<Reference Include="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Drawing.dll</HintPath>
</Reference>
</ItemGroup>
and save .csproj file and reload all.
I got some strange issue here, have a software that build normally in Visual Studio, all references where added using NuGet, and the Newtonsoft.Json.dll is in the packages folder and also the reference points to that folder.
When building in the build server, we notice test failures and going further we found that the Newtonsoft.Json.dll copyed in fact was the wrong one, from Blend folder.
From build log:
Copying file from "D:\APPS\Microsoft Visual Studio
12.0\Blend\Newtonsoft.Json.dll" to "D:\TB\2\PLWRO-WebPP\WebPP-Main-Dev-CI\bin\Newtonsoft.Json.dll".
To solve it I renamed Newtonsoft.Json.dll from blend folder for another thing, and then the build got to work normally as expected.
My question is, WHYYY?!?!? Seems that the build is looking for references before in the Blend folder and not in the set location in the hint path - see below.
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
You could try adding the <private>true</private> element after your HintPath element. This should force the copy to the local directory.
The other part that is interesting, you are looking for an old version (v4.5.0.0) whilst referencing a new version (7.0.1) in your packages.
In Visual Studio, you could try asking Nuget to update the reference to 7.x for this library, and then see if that helps MSBuild pull the library from a more specific location.