Reputation: 2446
I have a console application written mostly in C#, targeting .Net 4. It also uses a C++/CLI library which wraps an unmanaged C++ one. Everything is built in Release mode for x86 platform, except the C++?CLI library which is built in Win32.
So when I invoke the console application on my Win 7 workstation, it works. However, when I move over the folder to my Win 2003 SP2 app server, it does not load, claiming the following:
"System.IO.FileNotFoundException: Could not load file or assembly 'MyWrapper.dll' or one of its dependencies. The specified module could not be found. File name: 'MyWrapper.dll'".
I found the advice to add the following to my app.config, but it does not help:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
What am I missing?
Edit: .Net 4 is installed on my Win 2003 SP2 app server, and console apps written in pure C# and targeting .Net 4.0 do work on it.
Edit 2: MyWrapper.dll is in the same folder.
Edit 3: DependencyWalker shows the following dlls are missing: MSVCP100.DLL, MSVCR100.DLL, DWMAPI.DLL. I am installing the redistributable.
Upvotes: 1
Views: 1511
Reputation: 5165
My guess (if MyWrapper.dll is the Mixed mode assembly): The Microsoft Visual C++ 2010 Redistributable Package (x86) is not installed. You can use http://www.dependencywalker.com/ to find missing DLLs. Start Dependencywalker and open MyWrapper.dll - and you can find any missing DLLs.
Upvotes: 4
Reputation: 56391
First: is .NET 4 actually installed on your 2003 SP2 server?
Second: is the server actually an x86 server? Could it be an IA64 / Itanium CPU? Because if you pre-optimized for x86 it wouldn't run on such a server. I almost always recommend building for all platforms until you have a very good reason to do otherwise.
Third: What other libraries does MyWrapper.dll depend on? It's possible MyWrapper is fine but the other libraries are not loading for some reason. Follow the rabbit down the hole.
Upvotes: 1