Reputation: 12329
I'm having problems with my C# project. This is my scenario.
I have an external dll let's say original.dll
and I need to wrap it so it can be used in multiple vb.net apps, so I'm making another dll to wrapp this orginal dll called external.dll
. So while I'm developing this class library dll, I'm using a simple console project to test it, I included the references, build and test it with no problem... at least the first time, because when I try to rebuild my library and run it again it throws an exception
FileNotFoundException
Can't load file or assembly 'LynkLib, Version=1.0.5533.27875, Culture=neutral, PublicKeyToken=null' or any of it's dependencies.
I have already double checked the reference in VS, and the file on my folder. I try to restart VS and nothing.
Here is my code, but I don't know if it helps because I think is some kind of configuration issue.
using System.IO;
using System.Net;
...
[assembly: CLSCompliant(true)] //to use also in vb.net
namespace externalDLL{
[ComVisible(true)]
public class Lynk
{
//...my code
}
}
...
using externalDLL;
namespace TestLynk
{
class Program
{
static void Main(string[] args)
{
externalDLL.Lynk l = new Lynk(); //Here the exception is triggered
...
}
}
}
I found that the problem is on the original.dll
. I can't modify the code of that dll, I can only edit the external.dll
. I decompile the original dll and I can see the following assembly info
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
// Assembly LynkLib, Version=1.0.5533.27875, Culture=neutral, PublicKeyToken=null
// MVID: E24FF563-B283-431E-9D53-71A59E4750E1
// References: System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// References: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// References: System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// References: System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
[assembly: AssemblyTitle("LynkLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("###")]
[assembly: AssemblyProduct("###")]
[assembly: AssemblyCopyright("###")]
[assembly: AssemblyTrademark("")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("1.0.5533.27875")]
On the rest of the code, I can see a lot of issues, there are many, but they say basically two things // ISSUE: explicit constructor call
and // ISSUE: variable of a boxed type
I also downgraded my .NET version to 4.0 but still have problems. Any ideas?
Upvotes: 0
Views: 1650
Reputation:
Usually it is when you reference dll's that are build to a different .net target or platform (x86 or 64bit) as your settings for your current project. Otherwise one of the dll's is referencing another dll which cannot be found. You can download DotPeek from JetBrains for free and install. Open the dll's with DotPeek and see which other dll's they reference.
Upvotes: 1