Support for Portable Class Libraries?

Aug 11, 2011 at 3:30 PM

I can't seem to get SandCastle to work on a PortableClassLibrary that targets .Net 4, Silverlight, Win Phone.  Does sandcastle support this project type?  Is there a work around?

Editor
Aug 12, 2011 at 8:22 PM

Are you getting an error message?  If so, what is it?  Are you using Sandcastle by itself or are you using a front end like SHFB?

Eric

 

Aug 12, 2011 at 8:28 PM

I'm using SHFB.  But there error I'm getting is during the build.  See below...

I've tried this using the VBProject file and the .dll itself.  No luck.  Same error.  But everything works fine on normal project types (non Portable Library Projects)  And to add, that this project has no dependencies, its a simple project.  I have it set to build to Server, Silverlight & Windows Phone.

Generating reflection information...

[C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe]

MrefBuilder (v2.6.10621.1)

Copyright c Microsoft 2006

Info: Loaded 1 assemblies for reflection and 0 dependency assemblies.

MREFBUILDER : error : Unresolved assembly reference: System (System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes) required by ITA.eviti.Entities [C:\Users\iperez\Documents\Help\Working\GenerateRefInfo.proj]

Last step completed in 00:00:01.2131

-------------------------------

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

 

Editor
Aug 12, 2011 at 11:21 PM

That error with the 2.0.5.0 assembly version looks like the one you get if you try to build help for a Silverlight assembly.  Silverlight uses a different framework from the normal .NET assemblies so MRefBuilder can't find the right assembly version for the references unless it's told specifically to use the other framework.  Try setting the FrameworkVersion property in the SHFB project to one of the Silverlight framework versions.  That should get it to find the right assemblies.

Eric

 

Aug 15, 2011 at 2:58 PM

I changed the Framework Version to Silverlight 4.0 and this is what I get now.

-------------------------------

[Sandcastle Help File Builder Utilities, version 1.9.3.0]

Creating output and working folders...

-------------------------------

Clearing working folder...

-------------------------------

Finding tools...

Found Sandcastle tools in 'C:\Program Files (x86)\Sandcastle\'

-------------------------------

Validating and copying documentation source information

Source: C:\TFS-Repository\eviti\Development\WellPoint-Integration\ITA.eviti.Entities\bin\Debug\ITA.eviti.Entities.dll

Found assembly 'C:\TFS-Repository\eviti\Development\WellPoint-Integration\ITA.eviti.Entities\bin\Debug\ITA.eviti.Entities.dll'

Source: C:\TFS-Repository\eviti\Development\WellPoint-Integration\ITA.eviti.Entities\bin\Debug\ITA.eviti.Entities.xml

References to use:

agcore

agcore.debug

coreclr

Microsoft.CSharp

Microsoft.CSharp.Resources

Microsoft.ServiceModel.DomainServices.Tools

Microsoft.ServiceModel.DomainServices.Tools.resources

Microsoft.VisualBasic

mscorlib

mscorrc

mscorrc.debug

npctrl

npctrlui

system

System.ComponentModel.Composition

System.ComponentModel.Composition.Initialization

System.ComponentModel.Composition.Initialization.Resources

System.ComponentModel.Composition.Resources

System.ComponentModel.DataAnnotations

System.ComponentModel.DataAnnotations.Resources

System.Core

System.Data.Services.Client

System.Data.Services.Client.Resources

System.Json

System.Json.Resources

System.Net

System.Numerics

System.Numerics.Resources

System.Runtime.Serialization

System.Runtime.Serialization.Json

System.Runtime.Serialization.Json.Resources

System.ServiceModel

System.ServiceModel.DomainServices.Client

System.ServiceModel.DomainServices.Client.resources

System.ServiceModel.DomainServices.Client.Web

System.ServiceModel.DomainServices.Client.Web.resources

System.ServiceModel.DomainServices.EntityFramework

System.ServiceModel.DomainServices.EntityFramework.resources

System.ServiceModel.DomainServices.Hosting

System.ServiceModel.DomainServices.Hosting.OData

System.ServiceModel.DomainServices.Hosting.OData.resources

System.ServiceModel.DomainServices.Hosting.resources

System.ServiceModel.DomainServices.Server

System.ServiceModel.DomainServices.Server.resources

System.ServiceModel.Extensions

System.ServiceModel.Extensions.Resources

System.ServiceModel.NetTcp

System.ServiceModel.NetTcp.Resources

System.ServiceModel.PollingDuplex

System.ServiceModel.PollingDuplex.Resources

System.ServiceModel.Syndication

System.ServiceModel.Syndication.Resources

System.ServiceModel.Web

System.ServiceModel.Web.Extensions

System.ServiceModel.Web.Extensions.Resources

System.Windows

System.Windows.Browser

System.Windows.Controls

System.Windows.Controls.Data

System.Windows.Controls.Data.DataForm.Toolkit

System.Windows.Controls.Data.DataForm.Toolkit.Design

System.Windows.Controls.Data.DataForm.Toolkit.Expression.Design

System.Windows.Controls.Data.DataForm.Toolkit.VisualStudio.Design

System.Windows.Controls.Data.Design

System.Windows.Controls.Data.Expression.Design

System.Windows.Controls.Data.Input

System.Windows.Controls.Data.Input.Design

System.Windows.Controls.Data.Input.Expression.Design

System.Windows.Controls.Data.Input.Resources

System.Windows.Controls.Data.Input.VisualStudio.Design

System.Windows.Controls.Data.Resources

System.Windows.Controls.Data.Toolkit

System.Windows.Controls.Data.VisualStudio.Design

System.Windows.Controls.Data.VisualStudio.Design.Silverlight

System.Windows.Controls.DataVisualization.Toolkit

System.Windows.Controls.DataVisualization.Toolkit.Design

System.Windows.Controls.DataVisualization.Toolkit.Expression.Design

System.Windows.Controls.DataVisualization.Toolkit.VisualStudio.Design

System.Windows.Controls.Design

System.Windows.Controls.DomainServices

System.Windows.Controls.DomainServices.Design

System.Windows.Controls.DomainServices.Expression.Design

System.Windows.Controls.DomainServices.resources

System.Windows.Controls.DomainServices.VisualStudio.Design

System.Windows.Controls.Expression.Design

System.Windows.Controls.Input

System.Windows.Controls.Input.Design

System.Windows.Controls.Input.Expression.Design

System.Windows.Controls.Input.Resources

System.Windows.Controls.Input.Toolkit

System.Windows.Controls.Input.Toolkit.Design

System.Windows.Controls.Input.Toolkit.Expression.Design

System.Windows.Controls.Input.Toolkit.VisualStudio.Design

System.Windows.Controls.Input.VisualStudio.Design

System.Windows.Controls.Layout.Toolkit

System.Windows.Controls.Layout.Toolkit.Design

System.Windows.Controls.Layout.Toolkit.Expression.Design

System.Windows.Controls.Layout.Toolkit.VisualStudio.Design

System.Windows.Controls.Navigation

System.Windows.Controls.Navigation.Design

System.Windows.Controls.Navigation.Expression.Design

System.Windows.Controls.Navigation.Resources

System.Windows.Controls.Navigation.VisualStudio.Design

System.Windows.Controls.Resources

System.Windows.Controls.Theming.Toolkit

System.Windows.Controls.Theming.Toolkit.Design

System.Windows.Controls.Theming.Toolkit.Expression.Design

System.Windows.Controls.Theming.Toolkit.VisualStudio.Design

System.Windows.Controls.Toolkit

System.Windows.Controls.Toolkit.Design

System.Windows.Controls.Toolkit.Expression.Design

System.Windows.Controls.Toolkit.Internals

System.Windows.Controls.Toolkit.VisualStudio.Design

System.Windows.Controls.VisualStudio.Design

System.Windows.Data

System.Windows.Data.Resources

System.Xml

System.Xml.Linq

System.Xml.Linq.Resources

System.Xml.Serialization

System.Xml.Serialization.Resources

System.Xml.Utils

System.Xml.Utils.Resources

System.Xml.XPath

System.Xml.XPath.Resources

Copying XML comments files

C:\TFS-Repository\eviti\Development\WellPoint-Integration\ITA.eviti.Entities\bin\Debug\ITA.eviti.Entities.XML -> C:\Users\iperez\Documents\Help\Working\ITA.eviti.Entities.XML

-------------------------------

Generating shared content files (en-US, English (United States))...

Last step completed in 00:00:00.0200

-------------------------------

Generating API filter for MRefBuilder...

Last step completed in 00:00:00.0100

-------------------------------

Generating reflection information...

[C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe]

MrefBuilder (v2.6.10621.1)

Copyright c Microsoft 2006

Info: Loaded 1 assemblies for reflection and 117 dependency assemblies.

MREFBUILDER : error : Unresolved assembly reference: System (System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes) required by ITA.eviti.Entities [C:\Users\iperez\Documents\Help\Working\GenerateRefInfo.proj]

Last step completed in 00:00:01.4800

-------------------------------

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

 

Editor
Aug 15, 2011 at 7:21 PM

I see there's a "Retargetable=Yes" attribute in the version information.  That's not there in the error you get for normal Silverlight assemblies.  It's possible that MRefBuilder needs to use yet another set of reference assemblies instead.  Most likely, it will require adding a conditional property to the SHFB MRefBuilder step's project file template to have it include the portable framework targets so that it resolves the assembly references correctly.  I'll take a look into it.

Eric

 

Aug 18, 2011 at 3:15 AM

Any update on this yet?

Eric

Aug 18, 2011 at 4:08 AM

Hello All,

I am trying to reproduce this problem without any success.
I have created a generic project in both C# and VB.NET, setting the build target to both .NET 4 and Silverlight 4.0
and still got it compiled successfully in the SHFB. Both use the portable class libraries.

Those having the problem, can you create a generic project (VS.NET generated project without any other additions)
and see if there is any problem?

Best regards,
Paul 

Editor
Aug 18, 2011 at 5:39 PM

As expected, there is a separate set of reference assemblies for the portable framework.  I'll need to update SHFB to expose it as a new framework type.  It's similar to the Silverlight stuff so I should be able to implement it fairly quickly.  I plan on taking a look at it this weekend.

@Paul: The default code in a generic project only references mscorlib so it won't fail.  You need to reference a type in the code from another assembly such as using System.Uri from System.dll as a return type on a property so that it actually pulls it in.  Once you do that, it will fail with the noted error.

Eric

 

Aug 18, 2011 at 8:42 PM

@SelormeyPaul Well the problem definitely appears with Portable Library.

I had bad luck trying for starters to get SHFB to report System.Core no longer but the next assembly in the list. I think I tried all IL System.Core.dll's I could find on C: (not the native images)

Yet what appears to work right away is to go into VS and select all references of the Portable Library assembly and set Copy Local to True, then add the ones in the bin\Debug folder as references in SHFB.

However, this may cause VS to no longer 'Start with debugging' projects that reference the Portable Library, so make sure you put Copy Local back to False after SHFB has built and clean the bin and obj directories of (preferably) all projects in the solution.

That's a bit of tedious, but still a decent workaround.

Regards,

Eric

Editor
Aug 18, 2011 at 10:41 PM

A temporary workaround is to use the assembly and XML comments files as documentation sources in the SHFB project rather than the solution/project file and add the reference assemblies from one of the C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile folders as references in the SHFB project.

Eric

 

Editor
Aug 22, 2011 at 1:15 AM

I've implemented support for the .NET Portable Framework in SHFB.  I'll build and release v1.9.3.2 Alpha that includes the changes next weekend.  It'll be available by August 29th.

Eric

 

Aug 22, 2011 at 2:22 PM

Thanks so much for the quick reply and response!!!