I'm using Visual Studio 2019 Community Edition. After I added the reference under subdir with copy local set to true, it works fine, then I modified the app.config to
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="Mylib\"/>
</assemblyBinding>
</runtime>
</configuration>
thinking this may not require copy to local anymore, then I got
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Isn`t this the proper way to add subdir reference? (By the way, there is only *.dll.config but not *exe.config generated when I added item 'App.config' )
I finally found out that the problem here is the project type part, it seems that .net core does not support these traits, so I changed my project to console(.netframework) then the modifying app.config route works.
Related
I just tried to install CefSharp on a new winForm application, i install the latest version with Nuget and done all the steps by this article:
https://ourcodeworld.com/articles/read/173/how-to-use-cefsharp-chromium-embedded-framework-csharp-in-a-winforms-application
Running on : "Any CPU"
Visual Studio 2013
CefSharp 69.0.0
When i run the application i get this error:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'CefSharp.Core.dll' or one of its dependencies. The specified module could not be found.
This is the code:
var settings = new CefSettings();
Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null);
Any idea what is the problem?
EDIT
This is the app.config file of my project:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="x86"/>
</assemblyBinding>
</runtime>
</configuration>
In our case this happened when we failed to install the Visual C++ runtime.
In app.config file , please check dependentAssembly segment for CelfSharp.
If it has any entry, make sure that the version of added reference be in valid range.
When i build the solution , it was always create some assembly XML files,How should i disable auto create them?Thanks.
Also , i was set the privatePath, but the NuGet item (dll) cannot build in the privatePath. How should i setting?
App.Config:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="Bin" />
assembly XML files:
Dapper.xml
Dapper.SimpleCRUD.xml
...
We have an C# class library project which was created using .Net framework 3.5.In that C# project we add an assembly ABC.dll build using VS 2008 3.5 framework with version 5.5.0.0.
Now when we add ABC.dll with an updated version of 6.6.2.1 then in Designer view still get an error:
Could not load file or assembly 'ABC.dll, Version=5.5.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
I am really stuck and cannot find the reason in-spite of adding 6.6.2.1 why the project is asking for 5.5.0.0 version dll?
We are now using C# Express Edition 2010 to open the project.
Make sure that the reference is present and any dependent assemblies are referenced appropriately; you may need to make sure that the references have the property "SpecificVersion" set "false".
If the assemblies are present and the correct version - try cleaning the solution (Build | Clean Solution), as sometimes old versions linger in the project output folders and confuse Visual Studio.
You should be able to add an app.config file, telling your library which file to use when the .dll is called.
This should contain something like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ABC"
publicKeyToken="8fe83dea738b45b7"
culture="neutral"/>
<bindingRedirect oldVersion="5.5.0.0"
newVersion=" 6.6.2.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I am trying to use JSON.NET and after including the .dll and trying to use one of the methods I get this error:
Could not load file or assembly 'Newtonsoft.Json.Net35, Version=4.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
Any know why I might be this error?
Two things to check:
(1) You may have to "Unblock" the DLL. By default, when you download a .zip file from the Internet, that file, and all .dll or .exe files extracted from that .zip file, are given a file system attribute that prevents them from loading and executing. Right-click on the DLL in Windows Explorer, choose "Properties", and in the resulting dialog box click on the "Unblock" button. Or better yet, do that for the .zip file, and then re-extract all the files.
(2) The Newtonsoft JSON.NET library comes in five flavors: one each for .NET 2.0, 3.5, 4.0, Silverlight, and Windows Phone. You need to use the right one for your particular environment. I presume that this is a .NET 3.5 project?
In my case, I resolved this problem once I realized that a library that I was using was itself using the Json.NET but with the earlier version (3.5). Linking the second library to the new Json.NET version solved the issue.
Hope this helps.
You need to download release 1 instead of release 2 of the Newtonsoft.Json.
try to add assembly binding redirect to app config like:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.5.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Related posts:
System.IO.FileNotFoundException
At least one module has an unresolved import
Debugging tests that require an external dll
Hy guys. How I resolve this problem? Im gettin the error message:
The IDbCommand and IDbConnection
implementation in the assembly
MySql.Data could not be found. Ensure
that the assembly MySql.Data is
located in the application directory
or in the Global Assembly Cache. If
the assembly is in the GAC, use
element in the
application configuration file to
specify the full name of the assembly.
So, I added this lines to web.config:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="MySql.Data" fullName="MySql.Data, Version=6.3.6, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</assemblyBinding>
</runtime>
But didn't worked.
This is the method who configures the Hibernate:
private static ISessionFactory CreateSessionFactory()
{
return new NHibernate.Cfg.Configuration()
.Configure( #"C:\Users\Documents\Visual Studio 2010\Projects\Atendimento\NHibernateLayer\hibernate.cfg.xml" )
.AddAssembly( typeof( NHibernateHelper ).Assembly )
.BuildSessionFactory();
}
Anyone??? Tkhs!!!
I remember seeing this error message before, and the solution that worked for me (if memory serves!) was found in this blog entry.
You appear to be adding the appropriate line to your web.config, however have you verified that you're setting the correct version number / public key token?
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="MySql.Data"
fullName="MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
</qualifyAssembly>
</assemblyBinding>
</runtime>
That said - I've seen strange/confusing things happen when there's Version N of the MySql.Data assembly in the GAC and you have another copy that you're referencing that's Version M. Make sure that you're referencing the same version in your project as is the version in the GAC.