Online cams - Updating a processor

The DLLs have no choice, they need to be compatible with the process bitness.

If they are not then you'll get a big Kaboom with a Bad Image Format Exception when your code tries to use them. Set the EXE project's Platform target to x86, it isn't going to work with any other setting. For C# projects, the target of x86 does what it sounds like.

I then looked in the csproj of the referenced project and found this: If your C# DLL has x86-based dependencies, then your DLL itself is going to have to be x86. VS complains about changing it to (for example) x64 because a 64-bit executable can't load 32-bit libraries.

updating a processor-37updating a processor-13updating a processor-47

Your Any CPU assembly should be able to be loaded, but perhaps it is referencing some other dependency that is only capable of running in x86 configuration.

Check all dependencies and dependencies-of-dependencies to make sure everything is either "Any CPU" or "x64" if you plan to run the executable in 64-bit mode. In many ways, Visual Studio does not make compiling a mixture of Any CPU and various architecture dependent assemblies easy.

So a good selection for the DLLs is Any CPU so they work either way. It says that this assembly only supports x86 architectures. Any CPU on the other hand says that I don't care which architecture, I support both.

That makes lots of sense for C# DLLs, they get the build system to generate warnings about that. So, the next 2 questions are (1) what is the configuration of the executable that uses these dlls? The reason I ask is because if your executable is compiled to run in 64-bit, then it NEEDS all dependencies to be able to run in 64-bit mode as well.

This is also applicable if you are building a 64 bit project that has an x64 dependency; you would just select x64 instead.

One other note, projects can be "Any CPU" compatible usually if they are pure . This issue only comes up if you introduce a dependency (3rd party dll or your own C managed project) that targets a specific processor architecture.

In my case, it seems to have to do with the fact that certain project templates are added as certain platforms by default.

Here's the solution that often works for me: set everything to the correct platform in the Configuration Manager (the active configuration drop-down, says Debug normally, is a good way to get to it) and project platform (in project properties), then build, then set everything back to Any CPU.

I'm new to project configuration in Visual Studio 2010, but I've done some research and still can't quite figure this issue out.

Comments are closed.