Error loading project (1.8 Alpha)

Topics: User Forum
Nov 13, 2008 at 10:07 AM
Last night I added all the files in my SHFB project folder to my VS solution so I could check them into TFS. This morning I've extracted them on a different machine, but when I try to open the project in the GUI, I get a message saying "The imported project "C:\SandcastleHelpFileBuilder.targets" was not found. Confirm that the path in the <Import> declaration is correct and that the file exists on disk."

As far as I can tell, this is because $(SHFBROOT) is being evaluated as C: in the shfbproj file? If I change it to point to the install directory it's fine. Where does the SHFBROOT variable come from?
Nov 13, 2008 at 1:27 PM
OK, more information.

This problem only occurs when I launch SHFB from the "Open With..." context menu item in Visual Studio's Solution Explorer. When I launch the GUI from the start menu everything is fine.
Coordinator
Nov 13, 2008 at 4:13 PM
SHFBROOT is a system environment variable created by the installer.  It's used by the targets file to find the build tasks assembly.  If you manually copy the SHFB tools to another PC, you'll need to manually create the environment variable and point it at the right location.

Eric
Nov 13, 2008 at 4:51 PM
Ah. I suspect the problem will be that the devenv instance was running since before I ran the SHFB installer, so it didn't pick up the new environment variable. After quitting and restarting everything is fine. Sorry to have wasted your time.
Apr 2, 2009 at 1:28 AM
Edited Apr 2, 2009 at 1:31 AM
I got the same problem after tryjng to update to the latest Sandcastle and SHFB.
I was running?? I don't know, a version from October 2007.   I figured I would update and get current.  So I uninstalled the old {SHFB, Sandcastle} and then installed the May 2008 version of Sandcastle, and whatever is the latest SHFB. 

Then I tried to open the *.shfb file with a double-click in Explorer, or just launch from a cmd.exe window.  This used to work.   Hmm, not anymore!   SHFB is no longer a known extension.  So, next: Start...Programs....Sandcaste Help File Builder.  Then File...Open.   Bong!  That did not work.  Then I see I can convert an older version of the shfb file.  Ahhh, ok.  So I try that, and got this error. 

"The imported project "C:\SandcastleHelpFileBuilder.targets" was not found. Confirm that the path in the  declaration is correct and that the file exists on disk."

Huh?

Do I need to restart the computer after installing a new version of Sandcastle?

Can I just use setx to set the SHFBROOT environment variable? Why can't SHFB just look in the Registry for where it was installed? Or better, why can't Sandcastle Help File Builder just look in the directory it was launched from, ferpeetsake? The .targets file is in the same dir as the .exe! Why do I need to set an env var to tell the .exe where it lives? It knows!

Sandcastle and SHFB are very useful, but this seems like a pretty unnecessary complication.


Can I suggest that you reduce user hostility by doing the following:
  • register the .shfb extension, and automatically suggest the necessary conversion. Why make users go through the hassle of manually opening the tool and finding the Convert menu item?
  • eliminate the reliance on the SHFBROOT env var.

Should I enter this as a workitem?
Coordinator
Apr 2, 2009 at 5:29 PM

SHFB uses an MSBuild based project format now.  The SHFBROOT environment variable is used by MSBuild so that it can find the targets file needed to perform the build.  Usually, the environment variable is registered successfully without a reboot.  Occassionally, some people do need to reboot after installation.

Eric