c++/cli dll problem on Windows 7 without vs2008 installed
OK, here is my weirdness for today.
I create extensions to an existing C++ program that I DO NOT have access to the source code.I write standard C/C++ dlls and I use IJW to call C# dlls. I have not done this in awhile, but now I'm trying to get one to work on Window 7. I get an error (Error 0000036B1 - Not sure if that is an internal error number to the application, or a windows error.
I've got multiple virtual pcs (XP and Windows 7) The dll works just fine on XP. It also works on Windows 7 if Visual Studio 2008 is installed. but not on a clean Windows 7 with just the Microsoft Visual C++ 2008 SP1 Redistributable Package installed.
I can compile and run straight C++ dlls on the clean Windows 7 box as long as the compiler switch is set to MT[d] but if I set the /clr switch, I must change that to MD[d] and then it fails on the c开发者_JAVA技巧lean Windows 7 box. But, not on the Windows 7 box with Visual Studio 2008 installed.
Any ideas on what I need to install on the clean box? (other than VS of course ;-) )
Thanks for your help.
L. Lee Saunders
OK this is bad. Someone pointed out that the files I needed were the debug versions and that meant that I had compiled my dll in debug mode. He suggested that I try release mode.
So, with a new copy of my Virtual PC running Windows 7 Basic (this the 3.5 C++ redist installed) I copied over my original dll (the one in debug mode) just to verify that this Virtual PC had the issue. Yep it did.
Then I copied over a dll that was compiled in Release mode. It worked.
Ok, I officially want to pound my head on a wall.
Thanks for your time.
L. Lee Saunders
You will need both the VC++ Runtime Redistributable (which has support code for native C++) and the .NET Framework 3.5 (which has support code for C++/CLI).
.NET 3.5 should come with Win7, but VS2008 SP1 comes with .NET 3.5 SP1 so I would recommend installing all the .NET updates from Windows Update.
Now I feel bad. It was not completely a clean install of Windows 7. I needed to install the app that I'm writing extensions for. That programs' latest patch installed the Visual C++ 2008 SP1 Redistributable package.
Well, I decided to try creating an install project of a little bitty C++/cli dll and told it to include dependancies. It pulled in 2 files:
c:\program files\common files\merge modules\microsoft_vc90_debugcrt_x86.msm C:\Program Files\Common Files\Merge Modules\policy_9_0_Microsoft_VC90_DebugCRT_x86.msm
I ran the install and the tiny app worked. I manually copied over my dlls and lo and behold they worked now to. So to get it to work I needed these two files.
Why? And why were they not included in the Redist package?
精彩评论