dotnet / docfx

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

docfx metadata hangs at: Determining projects to restore... Nothing to do. None of the projects specified contain packages to restore. #10144

Open bartofzo opened 1 month ago

bartofzo commented 1 month ago

Describe the bug All of the sudden, when running docfx metadata, I get the message:

Loading project /Users/bart/Develop/anypath/AnyPath/AnyPath.csproj Determining projects to restore... Nothing to do. None of the projects specified contain packages to restore.

And nothing happens.

Expected behavior Metadata for the project should be built but instead nothing happens.

Context (please complete the following information):

Additional context This is a Unity project with Rider generating the csproj files. This used to always just work, but all of the sudden it doesn't anymore and I have no idea what changed.

doxfx.json for metadata:

"metadata": [ { "src": [ { "src" : "../AnyPath/", "files": [ "AnyPath.csproj" ] } ], "dest": "api", "disableGitFeatures": false, "globalNamespaceId" : "AnyPath", "disableDefaultFilter": false, "filter": "filterConfig.yml" }

partial AnyPath.csproj (if it helps?)

`

latest <_TargetFrameworkDirectories>non_empty_path_generated_by_unity.rider.package <_FullFrameworkReferenceAssemblyPaths>non_empty_path_generated_by_unity.rider.package true Debug AnyCPU 10.0.20506 2.0 AnyPath {7792acd9-70d2-b29b-3042-273b6d4beb5a} {E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Library Properties AnyPath v2.0 512 . true full false Temp\Bin\Debug\ DEBUG;TRACE;UNITY_2020_3_16;UNITY_2020_3;UNITY_2020;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;USE_SEARCH_ENGINE_API;SCENE_TEMPLATE_MODULE;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_NATIVE_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;INCLUDE_DYNAMIC_GI;ENABLE_MONO_BDWGC;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;PLATFORM_STANDALONE;PLATFORM_STANDALONE_OSX;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_GAMECENTER;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_SPATIALTRACKING;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_STANDARD_2_0;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;UNITY_PRO_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER;DEVELOPMENT_BUILD prompt 4 False False pdbonly true Temp\bin\Release\ prompt 4 False False true true false false false

`

adrian-moll commented 1 month ago

We had the same issue when building the documentation in our AzureDevops pipeline. The problem on our side seemed to be that we altered the buildNumber during the run (using Nerdbank.GitVersioning).

I do not really understand how this could interfere with docFx but when we disabled this feature in Nerdbank.GitVersioning the docFx command completed successfully.

Here the configuration in the version.json of Nerdbank that triggered the issue:

"cloudBuild": {
  "setVersionVariables": false, 
  "buildNumber": {
    "enabled": true // When true --> docFx "hangs" and doesn't complete
  }
goto01 commented 1 month ago

Hello, @bartofzo. I'm encountering the same issue with brew and dotnet. You can try downloading the DocFX build directly from the releases. However, have you found a solution for this issue?

bartofzo commented 3 weeks ago

Hello, @bartofzo. I'm encountering the same issue with brew and dotnet. You can try downloading the DocFX build directly from the releases. However, have you found a solution for this issue?

I don't know how to install docfx that way. I've already updated it to the latest release using dotnet tool update -g docfx which says it reinstalled the latest stable version 2.77.0

Is there a difference?

No, I haven't resolved it yet unfortunately...

bartofzo commented 3 weeks ago

We had the same issue when building the documentation in our AzureDevops pipeline. The problem on our side seemed to be that we altered the buildNumber during the run (using Nerdbank.GitVersioning).

I do not really understand how this could interfere with docFx but when we disabled this feature in Nerdbank.GitVersioning the docFx command completed successfully.

Here the configuration in the version.json of Nerdbank that triggered the issue:

"cloudBuild": {
  "setVersionVariables": false, 
  "buildNumber": {
    "enabled": true // When true --> docFx "hangs" and doesn't complete
  }

I'm not using NerdBank.GitVersioning. Where does it modify the build number? Is there something on my project side I shoud look into? (I've never modified anything about my project except for code and this issue just appeared out of the blue by the way)

adrian-moll commented 3 weeks ago

We had the same issue when building the documentation in our AzureDevops pipeline. The problem on our side seemed to be that we altered the buildNumber during the run (using Nerdbank.GitVersioning). I do not really understand how this could interfere with docFx but when we disabled this feature in Nerdbank.GitVersioning the docFx command completed successfully. Here the configuration in the version.json of Nerdbank that triggered the issue:

"cloudBuild": {
  "setVersionVariables": false, 
  "buildNumber": {
    "enabled": true // When true --> docFx "hangs" and doesn't complete
  }

I'm not using NerdBank.GitVersioning. Where does it modify the build number? Is there something on my project side I shoud look into? (I've never modified anything about my project except for code and this issue just appeared out of the blue by the way)

NerdBank.GitVersionning affects the build number of the assembly (incrementing the version based on git-history) and additionally sets some environment variables (influencing the BuildNumber inside our AzureDevops Pipeline) --> unfortunately i dont know what exactly what it does behind the scenes.

When I run docfx manually on my machine everyhting works. We only have the issue inside our build pipeline (and only when enabling the buildNumber options).

Do you have any special tool that affects your build ?

goto01 commented 3 weeks ago

Hello, @bartofzo. I'm encountering the same issue with brew and dotnet. You can try downloading the DocFX build directly from the releases. However, have you found a solution for this issue?

I don't know how to install docfx that way. I've already updated it to the latest release using dotnet tool update -g docfx which says it reinstalled the latest stable version 2.77.0

Is there a difference?

No, I haven't resolved it yet unfortunately...

You can download the compiled build from the Releases section here.

In the assets section download archive for your system and unzip it.

Screenshot 2024-08-21 at 10 46 07

Currently i'm using v2.75.3

bartofzo commented 3 weeks ago

Hello, @bartofzo. I'm encountering the same issue with brew and dotnet. You can try downloading the DocFX build directly from the releases. However, have you found a solution for this issue?

I don't know how to install docfx that way. I've already updated it to the latest release using dotnet tool update -g docfx which says it reinstalled the latest stable version 2.77.0 Is there a difference? No, I haven't resolved it yet unfortunately...

You can download the compiled build from the Releases section here.

In the assets section download archive for your system and unzip it.

Screenshot 2024-08-21 at 10 46 07

Currently i'm using v2.75.3

Yes, but how do I install it? The documentation only shows installation via the command line.

goto01 commented 3 weeks ago

Just download the archive and use the DocFX file within to generate documentation. For example, I downloaded the archive for macOS and unzipped it into /Users/my-user-name/Documents/Docfx.

In your project folder, you can use the DocFX file to run DocFX in your project folder like this: /Users/my-user-name/Documents/Docfx/docfx docfx-config.json --serve

bartofzo commented 3 weeks ago

Just download the archive and use the DocFX file within to generate documentation. For example, I downloaded the archive for macOS and unzipped it into /Users/my-user-name/Documents/Docfx.

In your project folder, you can use the DocFX file to run DocFX in your project folder like this: /Users/my-user-name/Documents/Docfx/docfx docfx-config.json --serve

Ok, I did this (also had to use xattr to make it run because of the malware protection). No difference... still hangs at Nothing to restore.

bartofzo commented 3 weeks ago

We had the same issue when building the documentation in our AzureDevops pipeline. The problem on our side seemed to be that we altered the buildNumber during the run (using Nerdbank.GitVersioning). I do not really understand how this could interfere with docFx but when we disabled this feature in Nerdbank.GitVersioning the docFx command completed successfully. Here the configuration in the version.json of Nerdbank that triggered the issue:

"cloudBuild": {
  "setVersionVariables": false, 
  "buildNumber": {
    "enabled": true // When true --> docFx "hangs" and doesn't complete
  }

I'm not using NerdBank.GitVersioning. Where does it modify the build number? Is there something on my project side I shoud look into? (I've never modified anything about my project except for code and this issue just appeared out of the blue by the way)

NerdBank.GitVersionning affects the build number of the assembly (incrementing the version based on git-history) and additionally sets some environment variables (influencing the BuildNumber inside our AzureDevops Pipeline) --> unfortunately i dont know what exactly what it does behind the scenes.

When I run docfx manually on my machine everyhting works. We only have the issue inside our build pipeline (and only when enabling the buildNumber options).

Do you have any special tool that affects your build ?

I don't think so. It's a Unity project. The solution is automatically generated.

bartofzo commented 3 weeks ago

Hello, @bartofzo. I'm encountering the same issue with brew and dotnet. You can try downloading the DocFX build directly from the releases. However, have you found a solution for this issue?

I don't know how to install docfx that way. I've already updated it to the latest release using dotnet tool update -g docfx which says it reinstalled the latest stable version 2.77.0 Is there a difference? No, I haven't resolved it yet unfortunately...

You can download the compiled build from the Releases section here.

In the assets section download archive for your system and unzip it.

Screenshot 2024-08-21 at 10 46 07

Currently i'm using v2.75.3

Ok so I've tried v2.75.3 and this opens up another can of worms. Running this gives me the following error:

Failed to find all versions of .NET Core MSBuild. Call to hostfxr_resolve_sdk2. There may be more details in stderr.

Which I've encountered before. I used to be able to resolve this by running:

export PATH=/opt/homebrew/Cellar/dotnet/7.0.100/libexec:$PATH

But apparently, I don't have dotnet 7 anymore and it is now dotnet 8. If I change the path to where dotnet8 .0.4 is located (don't ask me why this is even necessary for docfx to run...)

Then I get the following error: BadImageFormatException: Could not load file or assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An attempt was made to load a program with an incorrect format.

This is all of course with version v2.75.3 of docfx which is not the latest release. Running the most recent version of docfx still gives me the "Nothing to do" hang.

Are there any (Apple silicon) mac users out there that are able to run docfx without any issues?

goto01 commented 3 weeks ago

The whole situation with trying to run docfx on my mac is really odd. I have problems getting it to work, and the only way I’ve been able to run it on macbook m1 is by using the archive from the release section; all other options don’t work properly. I also have dotnet 8 installed.

bartofzo commented 2 weeks ago

Managed to work around it by building my project using Rider and running docfx metadata directly on the .dll file with the latest version.