-
Notifications
You must be signed in to change notification settings - Fork 25.2k
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
OpenAPI build-time generation's file destination is incorrect and causes build errors #34508
Labels
aspnet-core/svc
fundamentals/subsvc
Source - Docs.ms
Docs Customer feedback via GitHub Issue
⌚ Not Triaged
Comments
@sander1095 what OS and version? What .NET version? This happened on preview versions but was fixed in .NET 9 GA. |
Copied from the comment in the PR: #34509 WSL (Ubuntu 22.04)
Windows 11 Pro (10.0.22631 Build 22631, 23H2)
Building with ./The final csproj<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<OpenApiDocumentsDirectory>./</OpenApiDocumentsDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.ApiDescription.Server" Version="9.0.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project> Windows 11 Pro ❌dotnet new webapi -f net9.0
dotnet add package Microsoft.Extensions.ApiDescription.Server -v 9.0.1 # Install the latest version from nuget
# Add <OpenApiDocumentsDirectory>./</OpenApiDocumentsDirectory> to the csproj
dotnet build
# ERROR
PS C:\projects\Personal\temp6> dotnet build
Restore complete (0,3s)
temp6 failed with 2 error(s) (2,1s) → bin\Debug\net9.0\temp6.dll
C:\Users\stenb\.nuget\packages\microsoft.extensions.apidescription.server\9.0.1\build\Microsoft.Extensions.ApiDescription.Server.targets(68,5): error : Missing required option '--project'.
C:\Users\stenb\.nuget\packages\microsoft.extensions.apidescription.server\9.0.1\build\Microsoft.Extensions.ApiDescription.Server.targets(68,5): error MSB3073: The command "dotnet "C:\Users\stenb\.nuget\packages\microsoft.extensions.apidescription.server\9.0.1\build\../tools/dotnet-getdocument.dll" --assembly "C:\projects\Personal\temp6\bin\Debug\net9.0\temp6.dll" --file-list "obj\temp6.OpenApiFiles.cache" --framework ".NETCoreApp,Version=v9.0" --output "C:\projects\Personal\temp6\" --project "temp6" --assets-file "C:\projects\Personal\temp6\obj\project.assets.json" --platform "AnyCPU" " exited with code 1.
Build failed with 2 error(s) in 2,6s WSL (Ubuntu 22.04) ✅dotnet new webapi -f net9.0
dotnet add package Microsoft.Extensions.ApiDescription.Server -v 9.0.1 # Install the latest version from nuget
# Add <OpenApiDocumentsDirectory>./</OpenApiDocumentsDirectory> to the csproj
dotnet build
# SUCCESS
sander@PC-Sander:~/projects/temp$ dotnet build
Restore complete (0.5s)
temp succeeded (2.6s) → bin/Debug/net9.0/temp.dll
Build succeeded in 3.4s Building with .The final csproj<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<OpenApiDocumentsDirectory>.</OpenApiDocumentsDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.ApiDescription.Server" Version="9.0.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project> Windows 11 Pro ✅dotnet new webapi -f net9.0
dotnet add package Microsoft.Extensions.ApiDescription.Server -v 9.0.1 # Install the latest version from nuget
# Add <OpenApiDocumentsDirectory>.</OpenApiDocumentsDirectory> to the csproj
dotnet build
# SUCCESS
PS C:\projects\Personal\temp6> dotnet build
Restore complete (0,3s)
temp6 succeeded (0,7s) → bin\Debug\net9.0\temp6.dll
Build succeeded in 1,2s WSL (Ubuntu 22.04) ✅dotnet new webapi -f net9.0
dotnet add package Microsoft.Extensions.ApiDescription.Server -v 9.0.1 # Install the latest version from nuget
# Add <OpenApiDocumentsDirectory>.</OpenApiDocumentsDirectory> to the csproj
dotnet build
# SUCCESS
sander@PC-Sander:~/projects/temp$ dotnet build
Restore complete (0.5s)
temp succeeded (2.6s) → bin/Debug/net9.0/temp.dll
Build succeeded in 3.4s I hope this gives you all the info you need! As far as I see it, this issue persists in .NET 9 GA but is fixed on both Windows and Ubuntu when using |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
aspnet-core/svc
fundamentals/subsvc
Source - Docs.ms
Docs Customer feedback via GitHub Issue
⌚ Not Triaged
Description
Hi!
I ran into dotnet/aspnetcore#59157 . It correctly states the docs are incorrect:
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/openapi/aspnetcore-openapi.md#modifying-the-output-directory-of-the-generated-open-api-file
Using this
./
path causes a build error. It should changed to.
to build correctly.Page URL
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/aspnetcore-openapi?view=aspnetcore-9.0&tabs=visual-studio#modifying-the-output-directory-of-the-generated-open-api-file
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/openapi/aspnetcore-openapi.md
Document ID
27bad30c-e0b4-10fb-b202-a29d4f8fad24
Article author
@captainsafia
Metadata
Related Issues
The text was updated successfully, but these errors were encountered: