I have written a custom data-access library (aka DAL) which references [Microsoft.Practices.EnterpriseLibrary.Data.dll] as a dependency.
When my client app which has a reference to the DAL dll, try to use one of the DAL's methods, an exception is thrown:
Could not load file or assembly
'Microsoft.Practices.EnterpriseLibrary.Data, Version=6.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system cannot find the file specified.
If I, of course, put the EnterpriseLibrary dll in my client app bin folder (or make the client reference it...), there is no error, but it's a 'crooked' solution.
What is not clear to me is why referenceing ONLY my custom DAL dll is not enough?
And, is there a way to only reference the DAL dll without referencing EnterpriseLibrary dll's directly?
Related
I load a project from TFS to my local machine. But it need log4Net libary, and I download it from internet. It is rebuilt successfully. But when it runs, the exception comes.
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral,
PublicKeyToken=1b44e1d426115821' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)
I know this is the problem of mixing the version and publickey token. But my question is, when the code runs in visual studio, how can it know that it need log4net in version1.2 ? Anyone can help? Thank you.
What you have here is an assembly in your project that is referencing the log4net assembly with this version; it can be a direct reference, or an indirect reference (your project references A.dll that references log4net.dll)
Look through your projects to find the referencing assembly, and either satisfy the reference (get the correct version through nuget, that's the easiest) or change it. The referenced assemblies are contained in the project file (*.csproj or whatever extension is applicable to your language) with a Reference tag
When you include a reference, the naming strength will depend on what settings you chose:
<Reference Include="name">
<!-- here no version is specified because no specific version is needed -->
<Reference Include="name, Version=xxx, Culture=neutral, processorArchitecture=MSIL">
<-- version is specified, perhaps because a specific version was referenced at one time -->
Some more info can be found on this very site
I'm getting some really weird errors, see the repro here - https://github.com/tonyeung/nservicebus-structuremap-mvc5
A strongly-named assembly is required.
Could not load file or assembly 'NServiceBus, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
Unable to find the exported Type's in assembly NServiceBus.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c. One or more of the assembly's dependencies may be missing. Could not load file or assembly 'Raven.Abstractions, Version=2.0.3.0, Culture=neutral, PublicKeyToken=37f41c7f99471593' or one of its dependencies. The system cannot find the file specified.
for error number 1 - I had the configuration all set to go, but then it says strong name is needed.
for error number 2 - I commented out the configuration (whats i the repro right now), and I get the manifest error.
for error number 3 - not in repro since its my live project - I have structuremap inject an object that handles my message sending - wanted to create a repro for this, but since i can't even get a simple project going, I'm asking for help now.
The reason you having issues is because your MVC project outputs an assembly named "nservicebus.dll" which clashes the NServiceBus.dll assembly.
Rename the assembly of your MVC5 project to something that doesn't clash and then uncomment the code in the global.cs file.
Help please, I am having an error on the TFS. it complains that it cannot load the assembly below.
the project works fine on my computer. I searched for the dll by there is no such dll called: Microsoft.Web.Design.Server.
Any help pelase?
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.Design.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
The build server does not have the same software installed as your local machine. Thus when it goes to resolve dependencies it cannot find them.
This is compounded when your project has GAC references.
I recommend that anything which isn't a system assembly be copied to a folder and put into source control. The projects should then reference this assembly as a file reference instead of a GAC reference.
Since the file is now in source control it'll be available to the build server for it to resolve the assembly at compile time.
I am building an application using NHibernate. Because I could not add the DLL's of my current version of NHibernate (I cannot add reference when framework 4.0 is target).
I tried to get the latest and greatest of the w.w.w., this is what I have now:
NHibernate.dll (3.2.0.4000)
NHibernate.ByteCode.Castle (3.0.0.4000)
FluentNHibernate.dll (1.2.0.694)
Castle.Core (2.5.2.0)
Castle.Services.Logging.NLogIntegration (2.5.2.0)
Antlr.Runtim (3.1.3.42154)
Iesi.Collections (3.2.0.400)
These I can reference and build my solution with. I know there are some issues with the copying/loading of the dll.s so I made them deployment items.
But run-time I (still) get the following:
NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException: Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class.
Possible causes are:
- The NHibernate.Bytecode provider assembly was not deployed.
- The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed.
Solution:
Confirm that your deployment folder contains one of the following assemblies:
NHibernate.ByteCode.LinFu.dll
NHibernate.ByteCode.Castle.dll ---> System.TypeLoadException: Method 'IsProxy' in type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory' from assembly 'NHibernate.ByteCode.Castle, Version=3.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' does not have an implementation.
Thoughts anyone?
In response to Vijay Gill’s answer I have decided to take a different tack.
NUGet packages, a one-stop shop, and easy updates!
There is a FluentNHibernate package out there. I have installed it but I guess there is something amiss here too:
Test method CoreDatabaseTests.CreateCoreDatabase threw exception:
System.IO.FileLoadException: Could not load file or assembly 'NHibernate, Version=3.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ---> System.IO.FileLoadException: Could not load file or assembly 'NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
With NHibernate 3.2 you don't need NHibernate.ByteCode.Castle anymore, which considerably simplifies your dependency tree.
Getting components from various locations in such cases is nto a good idea, you compile everything from scratch. Well that's my experience so far. Fluent NH has not been updated to NH 3.2GA.
I would suggest you to download fluent NH and stick with the version that comes with it OR if you want to be on the bleeding edge, download the sources of fluent NH and compile with references set to latest NH (3.2GA).
I have a C# project that references a C++/CLI mixed mode assembly. That assembly is stored inside a folder into the PATH and it is also present at the GAC but when it is executed I get a:
System.IO.FileNotFoundException: Could not load file or assembly 'PcsSocketCommunications500, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
The version 0.0.0.0 is because the C++/CLI does not has an Assembly version class but as far as I know this shouldn't be a problem.
Running process monitor I've seen that the system just looks for the assembly at the same folder as the main process ... I'm not an expert of assembly loading but I expected to see at least some GAC searchs and 'maybe' some PATH searchs .. That's what I got (PcsSocketCommunication500.dll is the C++/CLI assembly and in black it's the working directory):
Any idea about why the loader is not checking the GAC or the PATH?
PublicKeyToken=null
The assembly isn't strong named. That means it can't be located in the GAC, the CLR isn't going to look there. Not sure what you did to get in the GAC, but it shouldn't be possible as-is.