Click here to Skip to main content
15,898,862 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all;

I am trying to create a managed CLR console app that is "self-contained",
that can be run without having to install anything, and I've run into a
bit of a situation.

It would seem that, even though I've specified a "pure" clr build, some
unmanaged DLL's are being utilized within that build anyway. When I create
a CLR Console App project, build it, then port the resulting executable over
to a system that does not have the .NET framework installed (a system
running Windows 2000 in this case), I get the following error message:
======================================================================
Unhandled Exception: System.TypeInitializationException: The type initializer
for '<Module>' threw an exception.
---> System.DllNotFoundException: Unable to load DLL 'msvcm90d.dll':
The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at <CrtImplementationDetails>.ThrowModuleLoadException(String , Exception )
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
at .cctor()
--- End of inner exception stack trace ---
======================================================================



One thing that I want to mention is that, in creating that project, I did
nothing to it. I left it "as is" - Console::WriteLine(L"Hello World"); in main.
I created the project to demonstrate the nature of the problem, and the
problem is not with my code, nor with anything that I am doing.

I thought that maybe if I tried to disable language extensions, it might not
reference the DLL, but no luck with that.

On building, I get the following:
Command line error 8016: options '/Za' and '/clr:pure' are not compatible.

I tried to change the Run-time library from "Multi-threaded DLL" (/MD)
to "Multi-threaded" (/MT), but that won't work either. On compilation,
I get:
/MTd and /clr:Pure are incompatible

I must compile with /MD (or /MDd) with clr option
(/MD => "Multi-threaded DLL").

Apparently, this is where I am getting the (unmanaged) msvcm90d.dll.

I've been trying to figure out how to statically link that library to
the executable, but I've not found anything that tells me explicitly
how to do that.

I tried adding "/FU msvcm90d.dll" to the command line for compilation,
but that didn't do me any good.

I've also tried #include "msvcm90d.dll", with no effect.

This is where I need some help.

How do I statically link that DLL to the build/executable?

Any other comments or suggestions would be appreciated.

Thanks!!!
Posted

CLR = Common Language Runtime = .net framework.


wylbur wrote:
I am trying to create a managed CLR console app that is "self-contained",
that can be run without having to install anything,
...
I create a CLR Console App project, build it, then port the resulting executable over to a system that does not have the .NET framework installed


In my mind this translates to: "I am writing a program that absolutely requires the .NET framework to run. How do I make it run without the .NET framework?"

I think you need to step back and reconsider your goals and needs and what methods you are using to get there.
 
Share this answer
 
Hi Avi;

I don't see any way to quote a post in this forum - maybe I missed
something somewhere.

In any case, you can call me a "big, fat, stupid, dummy-head" if you like,
but I was somehow under the impression that, once a .NET app was
compiled into MSIL, it didn't require the .NET framework to run
on another system.

So I guess I was being an idiot with that - yes?

Thanks for the response.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900