dotnet / docfx

Static site generator for .NET API documentation.
https://dotnet.github.io/docfx/
MIT License
4.06k stars 862 forks source link

docfx.console fails to build on UWP projects #1958

Closed smaillet closed 1 year ago

smaillet commented 7 years ago

DocFX Version Used: docfx.console v2.22.1

Template used: default

Steps to Reproduce:

  1. In VS2017 Create a Universal Class Library
  2. Add some doc comments to the default template generated class
  3. Save it
  4. Add a docfx file to the project
    
    {
    "metadata": [
    {
      "src": [
        {
          "files": [ "*.csproj" ],
          "exclude": [ "**/bin/**", "**/obj/**" ],
          "src": "."
        }
      ],
      "dest": "obj/api",
    }
    ],
    "build" : {
    "content": [
        {
          "files": ["**/*.yml"],
          "src": "obj/api"
        }
    ],
    "dest":"_site",
    "template": "default"
    }
    }
**Expected Behavior**:
Build will complete and generate documentation files

**Actual Behavior**:
Build fails to produce the help content output. Says it completed successfully but buried in it's output are a couple failures that contradict that claim. See log output line at [17-08-16 02:16:45.885]

1> [17-08-16 02:16:45.010]Verbose:Config file "C:\Users\\documents\visual studio 2017\Projects\\UWP./docfx.json" is used. 1> [17-08-16 02:16:45.120]Verbose:[MetadataCommand.ExtractMetadata](C:/Users//documents/visual studio 2017/Projects//UWP./UWP..csproj)Loading project C:/Users//documents/visual studio 2017/Projects//UWP./UWP..csproj 1> [17-08-16 02:16:45.885]Warning:[MetadataCommand.ExtractMetadata]Workspace failed with: [Failure] Msbuild failed when processing the file 'C:\Users\\documents\visual studio 2017\Projects\\UWP.\UWP..csproj' with message: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. C:\Users\\documents\visual studio 2017\Projects\\UWP.\UWP..csproj 1> [17-08-16 02:16:45.948]Warning:[MetadataCommand.ExtractMetadata]Project 'C:\Users\\documents\visual studio 2017\Projects\\UWP.\UWP..csproj' does not contain any documents. 1> [17-08-16 02:16:46.292]Verbose:[MetadataCommand.ExtractMetadata]Successfully generated metadata C:/Users//documents/visual studio 2017/Projects//UWP./obj/xdoc/cache/obj for UWP. 1> [17-08-16 02:16:46.307]Warning:[MetadataCommand.ExtractMetadata]No metadata is generated for UWP.. 1> [17-08-16 02:16:46.307]Info:[MetadataCommand]Completed Scope:MetadataCommand in 1259.8541 milliseconds. 1> [17-08-16 02:16:46.323]Verbose:[BuildCommand.ExportResourceFiles]Completed Scope:BuildCommand.ExportResourceFiles in 8.2939 milliseconds. 1> [17-08-16 02:16:46.323]Verbose:[BuildCommand.LoadPluginAssemblies]Completed Scope:BuildCommand.LoadPluginAssemblies in 0.002 milliseconds. 1> [17-08-16 02:16:46.339]Verbose:[BuildCommand]Loading plug-in... 1> [17-08-16 02:16:46.526]Verbose:[BuildCommand.ImportPlugins]Completed Scope:BuildCommand.ImportPlugins in 185.0282 milliseconds. 1> [17-08-16 02:16:46.526]Info:[BuildCommand]5 plug-in(s) loaded. 1> [17-08-16 02:16:46.526]Verbose:[BuildCommand] ConceptualDocumentProcessor with build steps (BuildConceptualDocument, CountWord, ValidateConceptualDocumentMetadata) 1> [17-08-16 02:16:46.526]Verbose:[BuildCommand] ManagedReferenceDocumentProcessor with build steps (BuildManagedReferenceDocument, ValidateManagedReferenceDocumentMetadata, ApplyOverwriteDocumentForMref, FillReferenceInformation) 1> [17-08-16 02:16:46.526]Verbose:[BuildCommand] ResourceDocumentProcessor with build steps (ValidateResourceMetadata) 1> [17-08-16 02:16:46.526]Verbose:[BuildCommand] RestApiDocumentProcessor with build steps (BuildRestApiDocument, ValidateRestApiDocumentMetadata, ApplyOverwriteDocumentForRestApi) 1> [17-08-16 02:16:46.526]Verbose:[BuildCommand] TocDocumentProcessor with build steps (BuildTocDocument) 1> [17-08-16 02:16:46.542]Info:[BuildCommand]No files are found with glob pattern */.yml, excluding , under directory "C:\Users\\documents\visual studio 2017\Projects\\UWP.\obj\api" 1> [17-08-16 02:16:46.620]Info:[BuildCommand]Markdown engine is dfm 1> [17-08-16 02:16:46.620]Verbose:[BuildCommand]Should trace post processing incremental info, because all post processors support incremental. 1> [17-08-16 02:16:46.620]Verbose:[BuildCommand]Cannot support incremental post processing, the reason is: it's disabled. 1> [17-08-16 02:16:46.620]Warning:[BuildCommand]No file found, nothing will be generated. Please make sure docfx.json is correctly configured. 1> [17-08-16 02:16:46.635]Verbose:[BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.RestoreIncrementalManifestItems]Completed Scope:BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.RestoreIncrementalManifestItems in 0.0638 milliseconds. 1> [17-08-16 02:16:46.635]Verbose:[BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.PreHandle]Set all incremental flags to false, since cannot support incremental post processing. 1> [17-08-16 02:16:46.651]Verbose:[BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.PreHandle]Completed Scope:BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.PreHandle in 1.5743 milliseconds. 1> [17-08-16 02:16:46.682]Verbose:[BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.HandlePostProcessors.Processing html]Completed Scope:BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.HandlePostProcessors.Processing html in 36.131 milliseconds. 1> [17-08-16 02:16:46.682]Verbose:[BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.HandlePostProcessors]Completed Scope:BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.HandlePostProcessors in 36.2007 milliseconds. 1> [17-08-16 02:16:46.682]Verbose:[BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.PostHandle.TraceIntermediateInfo]Completed Scope:BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.PostHandle.TraceIntermediateInfo in 0.072 milliseconds. 1> [17-08-16 02:16:46.698]Verbose:[BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.PostHandle]Completed Scope:BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.PostHandle in 8.7244 milliseconds. 1> [17-08-16 02:16:46.698]Verbose:[BuildCommand.Postprocess.HandlePostProcessorsWithIncremental]Completed Scope:BuildCommand.Postprocess.HandlePostProcessorsWithIncremental in 53.3284 milliseconds. 1> [17-08-16 02:16:46.698]Verbose:[BuildCommand.Postprocess]Completed Process in 54.1925 milliseconds. 1> [17-08-16 02:16:46.698]Verbose:[BuildCommand.Postprocess]Completed Dereference in 1.9762 milliseconds. 1> [17-08-16 02:16:46.714]Info:[BuildCommand.Postprocess]Manifest file saved to manifest.json. 1> [17-08-16 02:16:46.714]Verbose:[BuildCommand.Postprocess]Completed SaveManifest in 15.1065 milliseconds. 1> [17-08-16 02:16:46.729]Verbose:[BuildCommand.Postprocess]Completed Cleanup in 17.2876 milliseconds. 1> [17-08-16 02:16:46.729]Verbose:[BuildCommand.Postprocess]Completed Scope:BuildCommand.Postprocess in 97.8318 milliseconds. 1> [17-08-16 02:16:46.729]Info:[BuildCommand]Completed building documents in 198.5436 milliseconds. 1> [17-08-16 02:16:46.729]Verbose:[BuildCommand]Disposing processor html ... 1> [17-08-16 02:16:46.729]Verbose:[BuildCommand.Apply Theme]Completed Scope:BuildCommand.Apply Theme in 0.0022 milliseconds. 1> [17-08-16 02:16:46.729]Info:[BuildCommand]Completed Scope:BuildCommand in 420.1074 milliseconds. 1> [17-08-16 02:16:46.729]Info:Completed in 1682.975 milliseconds 1>
1>
1> Build succeeded with warning. 1> [17-08-16 02:16:46.729]Warning:[MetadataCommand.ExtractMetadata]Workspace failed with: [Failure] Msbuild failed when processing the file 'C:\Users\\documents\visual studio 2017\Projects\\UWP.\UWP..csproj' with message: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. C:\Users\\documents\visual studio 2017\Projects\\UWP.\UWP..csproj 1> [17-08-16 02:16:46.729]Warning:[MetadataCommand.ExtractMetadata]Project 'C:\Users\\documents\visual studio 2017\Projects\\UWP.\UWP..csproj' does not contain any documents. 1> [17-08-16 02:16:46.729]Warning:[MetadataCommand.ExtractMetadata]No metadata is generated for UWP.. 1> [17-08-16 02:16:46.729]Warning:[BuildCommand]No file found, nothing will be generated. Please make sure docfx.json is correctly configured. 1> 4 Warning(s) 1> 0 Error(s)

vicancy commented 7 years ago

According to the log, error occurs when opening workspace: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.

stale[bot] commented 5 years ago

Closing this issue after a prolonged period of inactivity. If you still think this issue is relevant, please feel free to ping a maintainer or leave a comment.

dotMorten commented 4 years ago

I'm hitting this issue as well with 2.47. The project I'm pointing to has no issue building.

[Failure] Msbuild failed when processing the file 'MyUwpProject.csproj' with message: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\WindowsXaml\v16.3\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Also, tried to find "Microsoft\WindowsXaml\v16.3\Microsoft.Windows.UI.Xaml.CSharp.targets" in the fallback search path(s) for $(MSBuildExtensionsPath)

That path however isn't correct. It shouldn't say v16.3 but only v16.0 (despite I have 16.3 installed)

dotMorten commented 4 years ago

Here's a repro I have: DocFXSample.zip

During the build step this'll generate the following warning:

[19-10-31 07:12:41.903]Info:Config file docfx.json found, start generating metadata...
[19-10-31 07:12:42.151]Info:[ExtractMetadata]Using msbuild C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin as inner compiler.
[19-10-31 07:12:42.458]Info:[ExtractMetadata]Loading projects...
[19-10-31 07:12:45.519]Info:[ExtractMetadata]Generating metadata for each project...
[19-10-31 07:12:47.421]Info:[ExtractMetadata]Loading projects...
[19-10-31 07:12:47.744]Info:[ExtractMetadata]Generating metadata for each project...
[19-10-31 07:12:47.834]Info:[ExtractMetadata]Loading projects...
[19-10-31 07:12:47.947]Info:[ExtractMetadata]Generating metadata for each project...
[19-10-31 07:12:48.021]Info:[ExtractMetadata]Loading projects...
[19-10-31 07:12:51.430]Info:[ExtractMetadata]Generating metadata for each project...
[19-10-31 07:12:52.464]Warning:[ExtractMetadata]Workspace failed with: [Failure] Could not find file 'E:\sources.tmp\DocFXSample\DocFXSample\obj\Release\monoandroid810\Resource.designer.cs'.
[19-10-31 07:12:52.525]Info:[ExtractMetadata]Loading projects...
[19-10-31 07:12:52.709]Info:[ExtractMetadata]Generating metadata for each project...
[19-10-31 07:12:52.760]Info:[ExtractMetadata]Loading projects...
[19-10-31 07:12:52.898]Warning:[ExtractMetadata](E:/sources.tmp/DocFXSample/DocFXSample/DocFXSample.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file 'E:\sources.tmp\DocFXSample\DocFXSample\DocFXSample.csproj' with message: C:\Users\mort5161\.nuget\packages\msbuild.sdk.extras\2.0.54\Build\LanguageTargets\CheckMissing.targets: (44, 5): The specified language targets for uap10.0.16299 is missing. Ensure correct tooling is installed for 'uap'. Missing: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\WindowsXaml\v16.3\Microsoft.Windows.UI.Xaml.CSharp.targets'
[19-10-31 07:12:52.902]Info:[ExtractMetadata]Generating metadata for each project...
[19-10-31 07:12:52.927]Info:Completed in 10802.965 milliseconds

Build succeeded with warning.
[19-10-31 07:12:52.934]Warning:[ExtractMetadata]Workspace failed with: [Failure] Could not find file 'E:\sources.tmp\DocFXSample\DocFXSample\obj\Release\monoandroid810\Resource.designer.cs'.
[19-10-31 07:12:52.934]Warning:[ExtractMetadata](E:/sources.tmp/DocFXSample/DocFXSample/DocFXSample.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file 'E:\sources.tmp\DocFXSample\DocFXSample\DocFXSample.csproj' with message: C:\Users\mort5161\.nuget\packages\msbuild.sdk.extras\2.0.54\Build\LanguageTargets\CheckMissing.targets: (44, 5): The specified language targets for uap10.0.16299 is missing. Ensure correct tooling is installed for 'uap'. Missing: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\WindowsXaml\v16.3\Microsoft.Windows.UI.Xaml.CSharp.targets'
        2 Warning(s)
        0 Error(s)

An ugly workaround would be to copy the v16.0 folder that is there to a new v16.3 folder, and this problem goes away.