...\V1.1.4322\mscorwks.dll could not be loaded.
I do in fact have the .NET Framework 1.1 installed on my machine, and I can run other applications with it.
I have a feeling it has to do with my trying to launch the .NET Framework too early in my application, or with a particular set of dll's
I found the following tantalizing posting on a web site, but the link the Microsoft KBase entry is broken. I tried searching for the KBase number (Q327125), but it's no longer there.
2/11/2003 Q327125 BUG: .NET Framework Initialization Error Occurs with Certain DLL Dependencies
When you start a managed application, you may receive the following error message: .NET Framework Initialization Error c:\YourFrameworkPathHere\mscorwks.dll could not be loaded After you dismiss this error message, you receive the following error...
Help!
Thanks.
Robert
Does your app share any dll dependencies with mscorwks.dll (run depends.exe
on mscorwks.dll, which can be found in the Windows SDK
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ or various
places on the web)? Is it possible that your app's dlls pull in
earlier/different versions of these dependent dlls into the process (which
causes mscorwks.dll to not load?)
Tim
--------------------
| Thread-Topic: mscorwks.dll could not be loaded (although I have installed
Framework 1.1)
| thread-index: AcPxbSstJ8bsTVr5SgGiG/Mx2RvkzQ==
| X-Tomcat-NG: microsoft.public.dotnet.framework.clr
| From: =?Utf-8?B?Um9iZXJ0?= <anon...@discussions.microsoft.com>
| Subject: mscorwks.dll could not be loaded (although I have installed
Framework 1.1)
| Date: Thu, 12 Feb 2004 05:36:07 -0800
| Lines: 18
| Message-ID: <264A097A-0B95-4951...@microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.clr
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.clr:9548
| NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
| X-Tomcat-NG: microsoft.public.dotnet.framework.clr
Thank you very much for the suggestion. I ran depends and compared all the dependencies of my app versus mscorwks.dll, and they both use the same versions of all the dll's that they depend on. So, unfortunately, that does not seem to be the problem.
Please let me know if you have any other thoughts on this problem.
Or, if you know how I can track down an archive of Microsoft KBase number Q327125, which may hold the answer.
Thanks again.
Robert
----- \"Tim Kurtzman\" wrote: -----
Thanks
Tim
BUG: .NET Framework Initialization Error Occurs with Certain DLL WGID:183
ID: 327125.KB.EN-US CREATED: 2002-07-29 MODIFIED: 2003-04-11
============================================================================
===
----------------------------------------------------------------------------
---
The information in this article applies to:
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ .NET (2003)
- Microsoft Visual C++, 32-bit Editions 6.0 (Version: 6.0)
- Microsoft Common Language Runtime (included with the .NET Framework) 1.0
(Version: 1.0)
- Microsoft Common Language Runtime (included with the .NET Framework 1.1)
- Microsoft .NET Framework 1.0 (Version: 1.0)
- Microsoft .NET Framework 1.1
----------------------------------------------------------------------------
---
SYMPTOMS
========
When you start a managed application, you may receive the
following error message:
.NET Framework Initialization
Error
c:\YourFrameworkPathHere\mscorwks.dll could not be loaded
After you dismiss this error message, you receive the following error
message:
The application failed to initialize properly (0xc0000142). Click on OK
to terminate the application.
CAUSE
=====
This error occurs because the application startup calls the
C-Runtime before it is completely initialized.
STATUS
======
Microsoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
MORE INFORMATION
================
Steps to Reproduce the Behavior
-------------------------------
There are two known scenarios that cause this problem.
Scenario One:
-------------
A nondebug EXE is mixed with a managed debug DLL. This scenario
only occurs on a computer that is running Windows 2000 or Windows XP.
1. To build the managed debug DLL, copy the following code to
TestDLL.cpp:
__declspec(dllexport) void test() {}
2. To build this DLL, use the following command line:
cl /LD /MDd /clr testDLL.cpp
3. To build the nondebug EXE, copy the following code to
Test.cpp:
extern void test();
int main() {
test();
}
4. To build this EXE, use the following command line:
cl /MD test.cpp testDLL.lib
5. Run test.exe, and notice that you receive the error message that is
described in the "Symptoms" section.
Scenario Two:
-------------
Use an unmanaged DLL that is built with the Visual C++ version
6.0 compiler (Cl.exe), which depends on a managed DLL that is built
with Visual
C++ .NET. You can reproduce the error with the following sample code
and build
options.
NOTE: These steps require that you have both Visual C++ 6.0 and Visual
C++ .NET available.
Build the Managed DLL
1. Copy the following sample code to a file that is named
Managed.cpp:
int g_2 = 0;
__declspec(dllexport) int Func2()
{
return (g_2 + 2);
}
2. Build this code on the Visual C++ .NET system. Run the Vcvars32.bat
file that is located in the \Microsoft Visual Studio .NET\VC7\bin
directory to configure a CMD prompt session for command line builds.
3. To build Managed.dll, use the following command line:
cl /clr /LD Managed.cpp
Build the Unmanaged DLL
1. Copy the following sample code to a file that is named
UnManaged.cpp:
__declspec(dllimport) int Func2();
int g_1 = 0;
__declspec(dllexport) int Func1()
{
return (g_1 + Func2());
}
2. Build this code with Visual C++ 6.0. Run the Vcvars32.bat file that
is located in the \Microsoft Visual Studio\vc98\bin directory to
configure a CMD prompt session for command line builds. NOTE: This must
be a separate CMD session from the first build so that the PATH and the
other environment variables that are created by Vcvars32.bat do not
conflict.
3. To build UnManaged.dll, use the following command line:
cl /MD /LD UnManaged.cpp /link Managed.lib
Build the Main Application
1. Copy the following sample code to a file that is named
Main.cpp:
__declspec(dllimport) int Func1();
__declspec(dllimport) int Func2();
int main()
{
return ( Func1() + Func2() );
}
2. You can build this code with either the managed code
process or the unmanaged code process (the compiler version is not
critical).
To build this code, use the following command line:
cl main.cpp /link Managed.lib UnManaged.lib
3. Run Main.exe, and notice that you receive the error message that is
described in the "Symptoms" section.
--------------------
| Thread-Topic: mscorwks.dll could not be loaded (although I have installed
Framework 1.1)
| thread-index: AcPyMAuTlcTkvsMYSQWMBQJ6wZ0C7A==
| X-Tomcat-NG: microsoft.public.dotnet.framework.clr
| From: =?Utf-8?B?Um9iZXJ0?= <anon...@discussions.microsoft.com>
| References: <264A097A-0B95-4951...@microsoft.com>
<RNSvv8a8...@cpmsftngxa07.phx.gbl>
| Subject: RE: mscorwks.dll could not be loaded (although I have installed
Framework 1.1)
| Date: Fri, 13 Feb 2004 04:51:06 -0800
| Lines: 82
| Message-ID: <2C8DE1DE-8C7F-48DA...@microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.clr
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.clr:9563
Thanks very much for digging up that article. The error messages I receive are exactly as described here, although my setup does not exactly match either of the 2 scenarios listed (I am running an unmanaged debug exe that depends on a managed debug dll, both of which were built using Visual Studio 2003). Even so, i suspect that I am running into this situation. Unfortunately, it doesn't look like the bug has been fixed, so I'll have to try to find some other workaround.
Thanks again.
Robert
----- \"Tim Kurtzman\" wrote: -----