MDbg Sample temporarily broken in post-beta 2 builds.

Customers have alerted us that the MDBg sample is broken on post-beta 2 builds. Rick Byers has diagnosed the problem as an issue in the mdbg build and we're working to update it. I guess there was a VS change that exposed this problem. Rick may blog a more detailed explanation, but I just wanted to get a quick post out to let people know we're aware of this and it's being addressed.

It fails with an error like this:

Error 1 The type or namespace name 'NativeApi' does not exist in the namespace 'Microsoft.Samples.Debugging.CorDebug' (are you missing an assembly reference?) C:\Documents and Settings\Administrator\Desktop\Whidbey Stuff\mdbg\mdbg\corapi\AppDomainEnumerator.cs 8 44 corapi

In the meantime, Rick's suggested fix is:

To fix this, you need to add “call ” to the beginning of the post-build event for corapi2.  I.e., the post-build event should be:

call "$(DevEnvDir)\..\tools\vsvars32.bat" > NUL && cd "$(ProjectDir)" && ilasm /KEY=../mdbg.snk /DLL /DEBUG /OUT="$(TargetDir)\corapi2.dll"> NUL

[update]: Rick has posted in more detail with a fix here.
I'll post again when we update the sample with the fix.

Comments (6)

  1. Notre says:

    Thanks, that fixes most everything. Now instead of hundreds of errors, I have one:

    "C:Program FilesMicrosoft Visual Studio 8Common7IDE\..toolsvsvars32.bat" > NUL && cd "C:Install Archivesmdbgmdbg" && ResGen mdbgCommands.txt

    ‘ResGen’ is not recognized as an internal or external command,

    operable program or batch file.

    C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Microsoft.Common.targets(814,9): error MSB3073: The command ""C:Program FilesMicrosoft Visual Studio 8Common7IDE\..toolsvsvars32.bat" > NUL && cd "C:Install Archivesmdbgmdbg" && ResGen mdbgCommands.txt" exited with code 1.

    This can be resolved by putting in the fully qualified path to resgen in the post-build event for mdbg.csproj

  2. Prem says:


    Will MDbg sample build with Visual C# 2005 Express Edition?

    I could not get it to build ( after adding the suggested fix).

    Wondering if it is not possible to build it in Visual C# 2005 Express Edition?

    btw, you have an awesome blog here!



  3. Prem – I’d don’t know what’s in the express edition, but I thought it was enough to build MDbg.

    What’s the error you’re getting?

  4. Prem says:

    I am wondering if I have correct beta version of VC# 2005 EE?


    Visual C# 2005 Express Edition Verison 8.0.50215.44 (beta2.050215-4400)

    .NET Framework Version 2.0.50215


    I could not locate any .bat file under C:Program FilesMicrosoft Visual Studio 8 and sub-dirs. (missing vsvars32.bat. Tools dir in VS.NET 2003 has many files and dirs, while Tools dir in VC# 2005 EE has only VDT dir!)

    292 errors are displayed.

    Bunch of errors about missing assembly refernce, dlls could not be found, and couple of errors (291,292) about prebuild and post build events exiting with code 9009



  5. Prem says:


    I was able to build the mdbg solution by hardcoding some of the paths.

    Replaced the mdbg pre-build event command line with:

    C:PROGRA~1MICROS~2SDKv2.0BinResGen $(ProjectDir)mdbgCommands.txt

    Replaced corapi2 post-build event command line with:

    C:WINDOWSMicrosoft.NETFrameworkv2.0.50215ilasm /KEY=../mdbg.snk /DLL /DEBUG /OUT="$(TargetDir)corapi2.dll"

    looks like the missing vsvars32.bat and related files are cause build failure in VC# 2005 EE.

    I hope, exclusion of these files in VC# 2005 EE is not by design!



  6. I actually haven’t used the Express Edition. I’m asking around to see what’s up.

    I’m glad you got it working in the meantime.

Skip to main content