开发者

Visual Studio fails to load x64 library and breaks intellisense

开发者 https://www.devze.com 2022-12-15 13:53 出处:网络
Visual Studio 2008 tries to load the libraries and I have one that is x64 only. I get the usual invalid format message because VS2008 is 32bit. In as ASP.NET MVC project that means no intellisens开发者

Visual Studio 2008 tries to load the libraries and I have one that is x64 only. I get the usual invalid format message because VS2008 is 32bit. In as ASP.NET MVC project that means no intellisens开发者_如何学运维e in the views. Is there any way to fix it? It's not very important if that library is not loaded at all for intellisense purposes.


Get both the 32-bit and 64-bit versions of the DLL.
If there aren't both available, ask the vendor, or if the library is open-source, compile them both yourself.

NOTE: If you're compiling them yourself, make sure they are strongly-signed. Create your own keys if necessary.

Then add both versions of the DLL to the GAC.

Restart VS. Possibly, restart the computer, or turn it off and walk around the block.

That worked for me.


I suspect that the problem is not the fact that it's x64, because IntelliSense has always worked fine for me in a Console Appication, even when referencing x64-only assemblies. Visual Studio doesn't actually need to run the assembly to get IntelliSense data - it only needs to inspect it using Reflection. You can see this for yourself if you try to run a 32-bit EXE that does the following:

string dllPath = "<path to 64-bit DLL";
System.Reflection.Assembly.ReflectionOnlyLoadFrom(dllPath); // Success
System.Reflection.Assembly.LoadFrom(dllPath); // BadImageFormatException

More likely it's just a problem with ASP.NET IntelliSense loading any assemblies. In my experience IntelliSense in ASP.NET is highly temperamental when it comes to referenced assemblies - and searching SO I can see I'm not the only one. I have gotten it to work sometimes, but it's more vodoo than science. You can try things like:

  • Close all open ASP files, clean solution, rebuild.
  • Remove the referenced assemhly, clean solution and and re-add it
  • Reference the external controls in Web.config instead of inside the pages.
  • Search for posts about ASP.NET IntelliSense problems on SO and MSDN forums to see what else people have come up with


Just looking here to see this...There was someone who was trying to load a x64bit dll under vs2008 and had similar situation you are experiencing...could it be that you need the redistributable pack of x64 for the VC++ runtime?

Hope this helps and best of luck, Best regards, Tom.


I do x64 and 32-bit development under VS.NET 2008 all the time. The program is very capable of loading x64 DLLs, but I suspect that you have a Win32 project so you can't load up a Win64 DLL into it. You have to pick either 64 bit or 32bit, you can't mix them at this point I understand.

0

精彩评论

暂无评论...
验证码 换一张
取 消