docfx icon indicating copy to clipboard operation
docfx copied to clipboard

Dependent child projects running .NET Standard cause DocFX to fail.

Open jamiehankins opened this issue 3 years ago • 2 comments

Operating System: Windows

DocFX Version Used: 2.58.0 (but really dev synced to HEAD).

Template used: default

Steps to Reproduce:

  1. git clone https://github.com/jamiehankins/ExtractMetadataBug.git
  2. cd ExtractMetadataBug
  3. msbuild ExtractMetadataBug.sln -t:Rebuild -p:Configuration=Release -p:Platform="Any CPU"

Expected Behavior: Builds with 0 errors, 0 warnings.

Actual Behavior:

[21-07-03 02:52:30.874]Warning:[MetadataCommand.ExtractMetadata](c:/git/ExtractMetadataBug/MainProject/MainProject.csproj)Workspace failed with: [Warning] Found project reference without a matching metadata reference: c:\git\ExtractMetadataBug\SupportLibrary\SupportLibrary.csproj

If you edit the two project files and change the TargetFramework to net5.0, it builds (and runs DocFX) fine with no warnings.

Our codebase has to be usable from both .NET Core and .NET Framework, so we're stuck with .netstandard2.0 for now.

jamiehankins avatar Jul 03 '21 03:07 jamiehankins

MSBuild wants to see reference assemblies when it enumerates dependencies. .NET 5.0 creates these by default.

I don't think there's a code-change to be made in DocFX, but there should be some documentation.

All I had to do was add this to my dependencies:

<ProduceReferenceAssembly>True</ProduceReferenceAssembly>

jamiehankins avatar Jul 06 '21 21:07 jamiehankins

Thanks for answering your own question, your question and answer was what I needed, worked like a charm.

patware avatar May 04 '22 13:05 patware