BadImageFormatException on New Project Wizard

Topics: Bugs, General Questions, Sandcastle
Aug 8, 2012 at 3:49 PM
Edited Aug 8, 2012 at 7:39 PM

I am receiving the following error when I try to add a DocProject solution to my C++ solution in Visual Studio:

---------------------------
New Project Wizard Error
---------------------------
An error occurred while running the New Project Wizard:



An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)



Review the Application event log for more information.
---------------------------
OK  
---------------------------

 


The application event log displays this:

An error occurred while running the New Project Wizard:

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
   at VSLangProj.References.AddProject(Project pProject)
   at DaveSexton.DocProject.VSAnyProject.AddReference(Object projectReference)
   at DaveSexton.DocProject.Wizards.ChooseSourcesStep.WizardFinished(WizardController controller)
   at DaveSexton.DocProject.Wizards.Foundation.WizardStep.WizardFinishedInternal(WizardController controller)
   at DaveSexton.DocProject.Wizards.Foundation.WizardController.<>c__DisplayClass9.b__8(WizardStep step)
   at DaveSexton.DocProject.Wizards.Foundation.WizardController.ForEachStep(Action`1 action)
   at DaveSexton.DocProject.Wizards.Foundation.WizardController.Finish(Boolean canceled)
   at DaveSexton.DocProject.Wizards.Foundation.WizardForm.finishButton_Click(Object sender, EventArgs e)

The project is still created, and trying to build it results in the following warning:

Warning: There are no project references or sources for documentation.
Help build skipped.

I am choosing all of the default settings except for the "Sources". I "Select All" project references during the "Choose Sources" dialog.

I am using Visual Studio 2008, SP1 is installed, VS 2008 SDK installed, Sandcastle is installed, Windows XP.

I was wondering if anybody here has experienced this, and if they have a known solution? I have been googling for some time now, and was only able to find this:

https://docproject.codeplex.com/discussions/240470

which really only suggests switching to doxygen, but I am trying to switch from doxygen to DocProject.

Update:

I would like to add that this does not occur if I am adding a DocProject to a C# solution. However, I get the following error when trying to build the DocProject project:

C:\Program Files\Dave Sexton\DocProject\bin\DaveSexton.DocProject.targets(40,5): error MSB4018: The "BuildDocProject" task failed unexpectedly.
C:\Program Files\Dave Sexton\DocProject\bin\DaveSexton.DocProject.targets(40,5): error MSB4018: System.InvalidOperationException: The Sandcastle build assembler API was not found.
C:\Program Files\Dave Sexton\DocProject\bin\DaveSexton.DocProject.targets(40,5): error MSB4018:    at DaveSexton.DocProject.Sandcastle.SandcastleBuildEngine.CreateSteps()
C:\Program Files\Dave Sexton\DocProject\bin\DaveSexton.DocProject.targets(40,5): error MSB4018:    at DaveSexton.DocProject.Engine.BuildEngine`2.get_Steps()
C:\Program Files\Dave Sexton\DocProject\bin\DaveSexton.DocProject.targets(40,5): error MSB4018:    at DaveSexton.DocProject.Engine.BuildEngine`2.CanBuild(BuildContext context)
C:\Program Files\Dave Sexton\DocProject\bin\DaveSexton.DocProject.targets(40,5): error MSB4018:    at DaveSexton.DocProject.Engine.BuildEngine`2.Build(BuildContext context)
C:\Program Files\Dave Sexton\DocProject\bin\DaveSexton.DocProject.targets(40,5): error MSB4018:    at DaveSexton.DocProject.Engine.BuildEngine`2.Build()
C:\Program Files\Dave Sexton\DocProject\bin\DaveSexton.DocProject.targets(40,5): error MSB4018:    at DaveSexton.DocProject.BuildController.Build(IDocProject project, BuildType buildType)
C:\Program Files\Dave Sexton\DocProject\bin\DaveSexton.DocProject.targets(40,5): error MSB4018:    at DaveSexton.DocProject.BuildController.Build(IDocProject project)
C:\Program Files\Dave Sexton\DocProject\bin\DaveSexton.DocProject.targets(40,5): error MSB4018:    at DaveSexton.DocProject.MSBuild.BuildDocProject.Execute()
C:\Program Files\Dave Sexton\DocProject\bin\DaveSexton.DocProject.targets(40,5): error MSB4018:    at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)
Coordinator
Aug 8, 2012 at 4:22 PM

Hi,

Which version of Sandcastle?

- Dave

Aug 8, 2012 at 4:31 PM
Edited Aug 8, 2012 at 4:40 PM

Hi Dave,

First tried with the Sandcastle May 2008 Release, and just tried with the June 2010 Release. Both versions are producing the same error.

Coordinator
Aug 8, 2012 at 7:34 PM

Hi,

Did you restart Visual Studio?  How about your computer?  (The latter probably doesn't matter unless you didn't do the former before installing DocProject.)

- Dave

Coordinator
Aug 8, 2012 at 7:39 PM

Hi,

Note that DocProject only supports Sandcastle May 2008.  I suspect that the build error when referencing your C# project is because you've installed a newer version of Sandcastle that DocProject doesn't support.

- Dave

Aug 8, 2012 at 7:55 PM

I have restarted Visual Studio and my PC numerous times.

The C# build error is still present with the May 2008 release of Sandcastle.

Coordinator
Aug 8, 2012 at 8:06 PM

Hi,

Are you aware of the VS SDK issue?

(See: Installing a Visual Studio SDK)
http://docproject.codeplex.com/wikipage?title=How%20to%20Diagnose%20and%20Resolve%20Issues#common

- Dave

Coordinator
Aug 8, 2012 at 8:16 PM

Hi,

I should also probably ask: 

Are you referencing a managed C++ project or a native C++ project?  DocProject and Sandcastle do not support native C++.

- Dave

Aug 8, 2012 at 8:25 PM
Edited Aug 8, 2012 at 8:26 PM

AH.

1) Yes I was aware of SDK issue. I ensured that the environmental variables were set correctly.

2) I am referencing a native C++ project.

Thanks for your help. Looks like I'll be sticking with doxygen.

Aug 8, 2012 at 10:00 PM
davedev wrote:

Hi,

I should also probably ask: 

Are you referencing a managed C++ project or a native C++ project?  DocProject and Sandcastle do not support native C++.

- Dave

Dave,

It appears there is support for native C++ in Visual Studio.

I tested the adding of a DocProject in VS 2005 to a native C++ project and it worked with no problems.

Unfortunately, that does not solve my problem at all.

Coordinator
Aug 8, 2012 at 10:06 PM
Edited Aug 8, 2012 at 10:06 PM

Hi,

Sandcastle doesn't support native C++ projects.  It can only build documentation for managed C++ projects.  That's why DocProject doesn't support native C++ projects either.

- Dave

Aug 8, 2012 at 10:12 PM

Hi,

DocProject provided a build for a native C++ project in Visual Studio 2005.

- Doug

Coordinator
Aug 8, 2012 at 10:20 PM

Hi Doug,

Well it wasn't on purpose, IIRC :)

Sandcastle has never supported native C++.  So there's no reason for me to have supported it in DocProject either.

- Dave