Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] .NET API bug #10495

Open
SatriyoJati opened this issue Jan 8, 2025 · 3 comments
Open

[Bug] .NET API bug #10495

SatriyoJati opened this issue Jan 8, 2025 · 3 comments
Labels
bug A bug to fix dotnet Generate .NET API reference docs

Comments

@SatriyoJati
Copy link

Describe the bug
I have project that has multiple project dependencies described in .csproj file. When creating metadata using .csproj file. It got an error about unable to find local depedencies for project.
Image

To Reproduce
Steps to reproduce the behavior:

  1. Having a project with local dependencies maybe in another folder
  • MyProject

    • myproject.csproj
    • src
  • LibraryProject

    • src

myproject.csproj

<Project Sdk="Microsoft.NET.Sdk">
...
 <ItemGroup> 
...
<PackageReference Include="LibraryProject" Version="1.0.0" />
...
 </ItemGroup>
...
</Project>

in the .csproj define packageReference to refer local project .

  1. setup the docfx
    Expected behavior
{
  "$schema": "https://raw.githubusercontent.com/dotnet/docfx/main/schemas/docfx.schema.json",
  "metadata": [
    {
      "src": [
        {
          "src": "../MyProject/",
          "files": [
            "**/*.csproj"
          ]
        }
      ],
      "dest": "api"
    }
  ],
  "build": {
    "content": [
      {
        "files": [
          "**/*.{md,yml}"
        ],
        "exclude": [
          "_site/**"
        ]
      }
    ],
    "resource": [
      {
        "files": [
          "images/**"
        ]
      }
    ],
    "output": "_site",
    "template": [
      "default",
      "modern"
    ],
    "globalMetadata": {
      "_appName": "mysite",
      "_appTitle": "mysite",
      "_enableSearch": true,
      "pdf": true
    }
  }
}

Context (please complete the following information):

  • OS: Windows 11 Pro

  • Docfx version: 2.78

  • .NET version: .NET 8.0

  • Exceptions

// Paste the full exception with stacktrace here, remove sensitive info
  • Errors and warnings
// Paste warnings or errors related to this bug here, remove sensitive info
Loading project C:/Users/CADIT-IDN/WORK/docgeneratorresearch/bugfixreference/etip.ecu/ETIP.ECU.InternalAPI/ETIP.ECU.InternalAPI.csproj
    <MyProject>.csproj : error NU1101: Unable to find package <name of package> No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org
  • .NET info

Additional context
Add any other context about the problem here.

@SatriyoJati SatriyoJati added bug A bug to fix dotnet Generate .NET API reference docs labels Jan 8, 2025
@filzrev
Copy link
Contributor

filzrev commented Jan 8, 2025

<PackageReference Include="LibraryProject" Version="1.0.0" />

From the attached screenshot and above project settings.

It seems you are referencing LibraryProject as PackageReference.
So custom NuGet package should be published on custom NuGet source.

But following log indicate it use only nuget.org source and custom NuGet source is not configured.
So NU1101 error is occurred because specified package is not exists on nuget.org source.

No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org


I thought NU1101 error can be reproduced by dotnet build command also.

If it can successfully build myproject.csproj with dotnet build command.
But failed with docfx metadata command.

Try test following command on myproject.csproj directory.

dotnet nuget list source

@SatriyoJati
Copy link
Author

here is the result of dotnet nuget list source :

  1.  nuget.org [Enabled]
      https://api.nuget.org/v3/index.json
  2.  Package source 2 [Enabled]
      <custom path>
  3.  Package source 3 [Enabled]
      <custom path>
  4.  Microsoft Visual Studio Offline Packages [Enabled]
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

does it mean I need to pack the project first then put it into the nuget list source ?

maybe my question is how can I generate docs for multiple dependent project let say above projects using docfx?
@filzrev

@filzrev
Copy link
Contributor

filzrev commented Jan 9, 2025

here is the result of dotnet nuget list source :

  1. Package source 2 [Enabled]
  2. Package source 3 [Enabled]

It seems custom nuget source is configured and recognized by dotnet command.

But these sources seems not recognized when running docfx metadata command.
(Because NU1101 error message don't contains custom sources)

I don't know what settings cause these behavior differences.

As far as I've confirmed.
docfx metadata command properly use custom configuration that is defined by NuGet.config file.
And it can't reproduce reported issues.

If it can able to provide minimum reproduceable files I'll try to investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug to fix dotnet Generate .NET API reference docs
Projects
None yet
Development

No branches or pull requests

2 participants