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

TargetFrameworks cause compile error #2706

Closed
ben-page opened this issue Sep 14, 2023 · 3 comments · Fixed by #3107
Closed

TargetFrameworks cause compile error #2706

ben-page opened this issue Sep 14, 2023 · 3 comments · Fixed by #3107
Milestone

Comments

@ben-page
Copy link

Libraries that reference Swashbuckle.AspNetCore and target multiple framework versions (<TargetFrameworks>net6.0;net7.0</TargetFrameworks>) fail to compile with the following error.

MSB3073
The command "dotnet "C:\Users\ben.page\.nuget\packages\microsoft.extensions.apidescription.server\6.0.5\build\../tools/dotnet-getdocument.dll" --assembly "C:\repos\SwashbuckleMultiTargetError\SwashbuckleMultiTarget\bin\Debug\net6.0\SwashbuckleMultiTarget.dll" --file-list "obj\SwashbuckleMultiTarget.OpenApiFiles.cache" --framework ".NETCoreApp,Version=v6.0" --output "obj" --project "SwashbuckleMultiTarget" --assets-file "C:\repos\SwashbuckleMultiTargetError\SwashbuckleMultiTarget\obj\project.assets.json" --platform "AnyCPU" " exited with code 3.

Replacing <TargetFrameworks>net6.0;net7.0</TargetFrameworks> with <TargetFramework>net7.0</TargetFramework> allows the code to compile.

Example Repo: https://github.com/ben-page/SwashbuckleMultiTargetError

@ben-page
Copy link
Author

This is the same issue reported on #1511. But that was closed because is was missing an example repo.

@jeremia
Copy link

jeremia commented Oct 3, 2023

This seem similar to the old aspnetcore issue 14370. This comment says that the scenario with using Swashbuckle in a library project isn't supported: dotnet/aspnetcore#14370 (comment).
It's obviously a use case for several people including me.
It just sounds like it's not supported because they didn't thought of that scenario.

@rianjs
Copy link

rianjs commented Dec 26, 2023

This is definitely still and issue, and the workaround still works.

Workaround: #1511 (comment)

@martincostello martincostello added the help-wanted A change up for grabs for contributions from the community label Apr 14, 2024
martincostello pushed a commit that referenced this issue Oct 11, 2024
@martincostello martincostello added this to the v6.8.2 milestone Oct 11, 2024
@martincostello martincostello removed the help-wanted A change up for grabs for contributions from the community label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants