I recently added the package LinqToExcel to my .net 4 WPF project and now when entering the designer I am presented with the following error:
System.IO.FileNotFoundException
Could not load file or assembly 'Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The system cannot find the file specified.
LinqToExcel only has one dependency - log4net, which it installed as part of the NuGet process. Both are referenced and set to Copy Local. I'm not sure where the reference to Castle is coming from or how to go about fixing it.
Does anyone have any suggestions?
Related
Searched SO but can't find a solution that works.
In Visual I've got a main project. It uses another project (ProjectA) that compiles to a DLL. That project uses Servicestack ORMLite 4.5.14. I've also installed Mysql.Data 6.9.12. ProjectA is reference in the main project by Project, not by compiled DLL.
The compiled application is copied to an other PC (just copy, no install) and started. However, when it tries to access the database using ProjectA I get the following error:
System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=8.0.20.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'MySql.Data, Version=8.0.20.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' ---> System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
at ServiceStack.OrmLite.MySql.MySqlDialectProvider.CreateConnection(String connectionString, Dictionary`2 options)
at ServiceStack.OrmLite.OrmLiteConnection.get_DbConnection()
at ServiceStack.OrmLite.OrmLiteConnection.Open()
at ServiceStack.OrmLite.OrmLiteConnectionFactory.OpenDbConnection()
at ServiceStack.OrmLite.OrmLiteConnectionFactoryExtensions.Open(IDbConnectionFactory connectionFactory)
at ProjectA.Repositories.ARepository.FindById(String id)
at ProjectA.Controllers.AController.FindById(String id)
at ProjectA.Service.DatabaseService.Find(String id)
What I've tried to solve the issue:
Compiled ProjectA and used the DLL as a reference instead of the project directly in the solution
Uninstalled all references of Mysql.Data and ServiceStack ORMlite and reinstall it
Changed .Net framework versions (4.5.2 and up)
Install the Mysql Connector on the machine where the application should run
Instlled Mysql.Data 8.0
Deleted the mysql.data.dll in the directory so it would be copied back. Checked the version of the DLL and it matches 6.9.12
Searched in the .csproj files for Mysql.data 8.0 and 6.9.9 but could not find a reference
Since it's using an old Mysql Server an older version of Mysql.Data is needed so also an older version of ServiceStack ORM lite.
I had this problem before, ProjectA is also used in a different project where Mysql 8.0 is needed. Since it's referenced as a project (not a DLL file) this changes back and forth. However, in the past reinstalling Mysql.data and Service Stack ORM lite did solve the issue. But now I'm unable to get past this error. I made sure the versions are the same for all projects in the solution. I'm aware this is bad practice but since we are rewriting the complete application was workable until now.
Any suggestions to solve this issue?
Turns out there was a cache directory in the obj with an service stack xml file referencing Mysql.Data version 6.9.9. Even after deleting the ServiceStack and Mysql.Data packages using NuGet package manager and reinstalling the correct version, this version number showed up in the ServiceStack xml file in de debug build directory.
Uninstalling ServiceStack and Mysql.Data packages, deleting the build directories (debug and release), deleting the obj directory, reinstalling the ServiceStack and Mysql.Data packages solved the problem.
Thanks for the answers #jdwang and #user9938.
I am trying to use MathNet.Filtering (https://github.com/mathnet/mathnet-filtering) and I receive during runtime the error Could not load the file or assembly 'MathNet.Filtering, Version=0.7.0.0, Culture=neutral, PublicKeyToken=null or one of its dependencies . The system cannot find the file specified. This happens when trying to use any part of the MathNet.Filtering class.
Such as
MathNet.Fitering.OnlineFilter myFilt = MathNet.Filtering.OnlineFilter.CreateBandpass(MathNet.Filtering.ImpulseResponse.Finite, 8000,100,15000,50);
I am already referencing MathNet.Numerics as it is a dependency to MathNet.Filtering.
I am compiling and running with .NET 4.6.1 and the dll for MathNet is built to target .NET 4.6.1.
Using dotPeek I can see there are other dependencies:
MathNet.Numerics (already referenced version 4.9.1.0)
mscorlib
System
System.Core
System.Numerics
System.ValueTuple
[]
I am struggling to see why I am getting Could not load the file or assembly . There are no external references missing.
Is the problem related to System.ValueTuple?
I can use the MathNet.Numerics classes without any issue, this has all the same dependencies except System.ValueTuple
But when I try and explicitly reference System.ValueTuple's DLL I receive
System.ValueTuple exists in both [path to reference] and C:\Windows\[...]\mscorlib.dll
Any ideas what is going on here? Stuck at this for hours
Thanks
I'm working on an Azure Function that uses a couple of nuget packages to decode Json web tokens.
I've referenced System.IdentityModel.Tokens.Jwt and Microsoft.IdentityModel.Protocol.Extensions in the project.json and it compiles fine.
I'm able to use classes and methods from System.IdentityModel.Tokens.Jwt but it appears that Microsoft.IdentityModel.Protocol.Extensions cannot see the assembly.
"One or more errors occurred. Microsoft.IdentityModel.Protocol.Extensions: Could not load file or assembly 'System.IdentityModel.Tokens.Jwt, Version=4.0.20622.1351, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."
I double checked the dependencies from the nuget package source and in Kudu to ensure they are present.
I'm a bit stuck as to what to investigate next!
Cheers,
Jordan.
I'm involved in a IoT project and considering orleans as a platform. I tried to do the basic tutorial here:
http://dotnet.github.io/orleans/Step-by-step-Tutorials/Minimal-Orleans-Application
It seems to be working but I'm getting the following exceptions in the console which would be nice to get rid of:
Could not load file or assembly 'OrleansCodeGenerator' or one of its
dependencies. The system cannot find the file specified. Exception =
System.IO.FileNotFoundException: Could not load file or assembly
'OrleansCodeGenerator' or one of its dependencies. The system cannot
find the file specified.
Could not load file or assembly
'Microsoft.Extensions.DependencyInjection.Abstractions,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or
one of its dependencies. The system cannot find the file specified.
I'm using orleans version 1.1.0
This is a know issue on the template packages. Could you please add the Nuget Microsoft.Extensions.DependencyInjection.Abstractions version 1.0.0-rc1-final on the Silo host Project? For the other exception, looks like are missing the OrleansCodegenerator package. Could you please ensure that .Server nuget is on Silo Host, .Client on Client/FrontEnd and .Core in Interfaces/Grain project? I think it will work otherwise, feel free to open an issue on https://github.com/dotnet/orleans and we will have a look.
More info
The reason this dependency is not added by default as a OrleansCodegenerator dependency, is that this package is not published as a stable package (it is marked as pre-release) and we can't have pre-release packages on Orleans packages otherwise, we would must release Orleans packages as -pre packages. As soon as this package is published as release we are going to update Orleans packages to contain it.
All of a suddon, I'm getting a FileLoadException when getting an instance of a class from Ninject.
The exact exception is the following:
System.IO.FileLoadException: "Could not load file or assembly 'Quartz, Version=2.3.3.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"
When reading the error message, it seems quite clear that it tries to load an assembly of Quartz with version 2.3.3.0 but the specified version is another... but I don't get why it even loads version 2.3.3.0.
I searched the whole solution (inclusive the .csproj) for Quartz references and every reference states v1.0.1.2.
I've searched the path on the file system for Quartz.dlls but could only find dlls of version 1.0.1.2 so I don't understand why it tries to load 2.3.3.0.
Do you know of any steps I could try to solve this exception?
Thanks in advance
Check the class library that includes Quartz. Make sure that the platform version is consistent. You can do this by right clicking on the project file and selecting properties. Then check the assembly version in the first/top most tab.
Whatever platform version you have in that class library should be consistent with the other projects in the solution.
This happens when you install some other nuget package (like Quartz.Unity) which depends on Quartz. While installing that other package if you select 'lowest' option for dependency then it would set Quartz 2.3.3.0 as dependency. However, you have Quartz 2.4.1 installed in your package. So you get the error.
Solution: While installing that other package select 'highest' option for dependency if you have highest version installed in your project.