This project has moved and is read-only. For the latest updates, please go here.

Still works in .NET 4.0 beta 2.

Jan 20, 2010 at 1:27 PM

I tried it yesterday, and it still works for .NET 4.0 Assemblies even that Sandcastle and SHFB is running in the 2.0 CLR, but not without some tweaking:

How to make it work: 
Copy all referenced assemblies to the same folder, including the 4.0 System assemblies. Then it compiles and the files are generated.

- Rune

Jan 31, 2010 at 6:12 PM

A somewhat easier solution, which is working fine for me, is to edit the .shfb file manually and change the ToolsVersion attribute of the root element to "4.0". Looking at the source for the program, it seems to already have the capability for handling .NET 4.0 projects.

Thanks to EWoodruff not only for creating a great UI but for already integrating (at least partial) .NET 4.0 support.

Feb 26, 2010 at 9:15 PM

I'm trying with a .NET 4.0 RC assembly and I'm not having much luck. I tried changing the ToolsVersion in the shfbproj file, but I still get the same errors. I get unresolved assembly references even for assemblies I explicitly add references for. If I add them as documentation sources, I get a farther but I have to enter every single Framework dependency and, ultimately, it crashing trying to resolve a reference.

Feb 27, 2010 at 3:11 AM
Edited Feb 28, 2010 at 6:55 PM

Have you applied the latest Sandcastle Styles patch which includes the required MRefBuilder.exe.config that lets MRefBuilder parse .NET 4.0 assemblies?  It will need updating to include the latest version number that comes with VS2010 Release Candidate.


Mar 1, 2010 at 12:30 PM


I'm having a similar problem as jimlamb. For a .NET 4.0 (RC) project, I'm getting the following error:

MREFBUILDER : error : Unresolved assembly reference: System.Core (System.Core, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089)

The most recent version of Sandcastle Styles is installed (May 2008 Patch Rev 3).  Any idea how to work around this problem?



Mar 1, 2010 at 6:38 PM

You'll need to update the MRefBuilder.exe.config to include the RC version of the .NET 4.0 framework.  Once done, it should work:

<supportedRuntime version="v4.0.30128"/> <!-- 4.0 RC installed by VS2010 RC -->



Mar 2, 2010 at 7:01 AM

Thanks Eric! Worked perfectly.

Note to others - Make sure you edit the file as administrator on Windows 7 (maybe also Vista) or the file gets moved into the virtual store and you may have problems. I did, but just had to copy it back as administrator.

Mar 2, 2010 at 4:17 PM

I applied the Sandcastle May 2008 (2.4.10520) Patch - Rev 3 to my existing installation and updated the MRefBuild.exe.config to include the RC version of the .NET 4.0 framework. My documentation project still isn't building successfully, however.

Generating reflection information...
  MrefBuilder (v2.4.10520.1)
  Copyright c Microsoft 2006
  Unknown target platform version '4.0'.
C:\Users\JimLamb\Sources\TfsSdk\Solutions\ExtendingTeamProjects\#\Help\Working\GenerateRefInfo.proj(35,5): error MSB6006: "MRefBuilder.exe" exited with code 1.
    Last step completed in 00:00:05.1070

SHFB: Error BE0043: Unexpected error detected in last build step.  See output above for details.

Mar 2, 2010 at 4:36 PM

You appear to be using an older version of SHFB which doesn't properly support .NET 4.0.  Upgrade to v1.8.0.3 which contains support for .NET 4.0.



Mar 2, 2010 at 4:51 PM

According to the About box, I am running

Mar 3, 2010 at 3:20 AM

If you check the MRefBuilder.config file in the working folder after the build fails you should see the platform element with the version attribute set to 4.0.  That's the cause of the error.  If that's the case, the build is running using an older version of SHFB.  You might check your SHFBROOT environment variable to make sure it isn't pointing to an outdated version.  If you're running Vista or Windows 7 and have modified any of the SHFB template files, you might check to be sure that a virtualized copy of an older version isn't hanging around and thus overriding the newer files.



Mar 3, 2010 at 7:12 PM

Here's the first part of the MRefBuilder.config file in my Working directory:

    <!--<platform version="2.0" path="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\" />-->
    <platform version="4.0" path="%SystemRoot%\Microsoft.NET\Framework\v4.0.30128\" />
    <resolver type="Microsoft.Ddue.Tools.Reflection.AssemblyResolver" assembly="C:\Program Files (x86)\Sandcastle\ProductionTools\MRefBuilder.exe" use-gac="false" />
      <addin type="Microsoft.Ddue.Tools.ExtensionMethodAddIn" assembly="C:\Program Files (x86)\Sandcastle\ProductionTools\MRefBuilder.exe" />
      <addin type="Microsoft.Ddue.Tools.XamlAttachedMembersAddIn" assembly="C:\Program Files (x86)\Sandcastle\ProductionTools\MRefBuilder.exe" />
    <attributeFilter expose="true">
      <!-- Most attributes in System.ComponentModel control designer behavior. Don't show them. -->
      <!-- The exceptions are attributes relating to data binding. Do show them. -->
      <namespace name="System.ComponentModel" expose="false">

The environment variable is set as follows:
SHFBROOT=C:\Program Files (x86)\EWSoftware\Sandcastle Help File Builder\ 

I'm going to try uninstalling SHFB and Sandcastle, manually removing anything left and re-installing.

Mar 3, 2010 at 7:43 PM

I uninstalled SHFB and Sandcastle, manually removed any remaining folders/files related to either, then re-installed following the prescribed directions. My project now builds, but the resulting CHM file has problems. I get a "This program cannot display the webpage" error for every topic. Any suggestions?

Mar 3, 2010 at 8:15 PM

You'll see that error if you are trying to view the help file off of a network share.  Copy it to your local hard drive and you can open it from there.  If it's built on another machine, you may need to unblock it.  See the FAQ topic in the help file for how to allow viewing help files on network shares and how to unblock help files (Why doesn't my compiled help file load? / Why do all of the help file topics display a "Page not found" error?).



Mar 3, 2010 at 9:47 PM

Yes, I'm all to familiar with that behavior, but that's not the case here. The file is on my local file system and I'm addressing it using a local path. It's not showing as 'blocked' in Windows Explorer and there's no reason for it to be. This is really getting frustrating.

I've previously built CHM files for .NET 2.0 and 3.5 projects without any issues.

Mar 4, 2010 at 12:48 AM

Is there a "#" in the folder path?  That will also prevent it from displaying.  That's a limitation of the CHM viewer.  You need to move it to a folder where there isn't a "#" in the path or rename the folder that contains it.



Mar 4, 2010 at 2:09 PM

Wow, that was the problem. I use '#' as the folder name for my 'Main' branch - just a convention of mine. What a goofy limitation. Thanks!

Mar 4, 2010 at 2:17 PM

By the way, thanks for your patience and help getting this up and working. I use SHFB to build the CHM file for the TFS API documentation. It's a stop gap measure until we get our MSDN documentation updated. I've been wanting to generate a CHM file for the Workflow 4.0 Activities we ship for TFS Build, but hadn't been able to get it working. Now that I've gotten a canonical .NET 4.0 assembly working, I should be able to get documentation generated for our workflow activities.

Apr 15, 2010 at 1:21 AM

Also, going with EWoodruff's comment above. I was having trouble building the RTM version of .net 4.0.

The C:\Program Files (x86)\Sandcastle\ProductionTools\MrefBuilder.exe.config file needs to have the following added to it.

<supportedRuntime version="v4.0.30319"/> <!-- 4.0 RTM -->

May 8, 2010 at 12:11 AM


Thanks, man! This solved my problem!

May 8, 2010 at 3:12 AM

Glad to help.