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

[Feature Request] Global tool .NET 7 support #8323

Closed
Apollo3zehn opened this issue Jan 5, 2023 · 12 comments
Closed

[Feature Request] Global tool .NET 7 support #8323

Apollo3zehn opened this issue Jan 5, 2023 · 12 comments

Comments

@Apollo3zehn
Copy link

Apollo3zehn commented Jan 5, 2023

Is your feature request related to a problem? Please describe.
I have only .NET 7 installed on my system (Kubuntu 22.10) by just downloading the SDK. I have also a .NET 6 SDK in a different folder but to make the global tool work I need to do the following:

sudo rm /usr/bin/dotnet
sudo ln -s /home/<user>/Dokumente/Software/dotnet-6.0/dotnet /usr/bin/dotnet
DOTNET_ROOT=/home/<user>/Dokumente/Software/dotnet-6.0 /home/<user>/.dotnet/tools/docfx metadata

And then switch back when done.

Describe the solution you'd like
I would be great if the tool is also compiled for .NET 7 so this is not required anymore.

Additional context
https://github.com/dotnet/docfx/releases/tag/v2.60.0-preview.2

@KalleOlaviNiemitalo
Copy link

dotnet/sdk#26417 (comment) seems to recommend that .NET tool packages allow major version roll-forward.

@KalleOlaviNiemitalo
Copy link

  <PropertyGroup>
    <RollForward>Major</RollForward>
  </PropertyGroup>

See dotnet/sdk#3296, https://learn.microsoft.com/dotnet/core/project-sdk/msbuild-props#rollforward.

@Apollo3zehn you may be able to override by setting DOTNET_ROLL_FORWARD=Major in the environment.

@Apollo3zehn
Copy link
Author

Thanks @KalleOlaviNiemitalo! While this in principal works (the build output is generated successfully), it gives me the following warning multiple times:

grafik

@KalleOlaviNiemitalo
Copy link

Huh so the problem is not only running the DocFX tool within .NET SDK 7, but also running .NET SDK 7 (with MSBuild and NuGet) during docfx metadata.

@KalleOlaviNiemitalo
Copy link

Why are the NuGet DLLs even included in the DocFX tool package? Searching for "NuGet." in the other DLLs of the tool package does not find any hits, except in Newtonsoft.Json.dll, which contains the text https://www.nuget.org/packages/Newtonsoft.Json.Bson.

@Apollo3zehn
Copy link
Author

Apollo3zehn commented Jan 5, 2023

Since it happens in a AssemblyLoadContext method I guess that a plugin is being loaded and that this plugin has the Nuget dependency.

@KalleOlaviNiemitalo
Copy link

DocFX uses MSBuildLocator to find the MSBuild assemblies so that they need not be included in the DocFX package. I hope the NuGet assemblies could be likewise loaded from the Visual Studio or .NET SDK installation rather than shipped with DocFX.

@paulushub
Copy link

Since it happens in a AssemblyLoadContext method I guess that a plugin is being loaded and that this plugin
has the Nuget dependency.

I found no instance of the AssemblyLoadContext class or the System.Runtime.Loader namespace. Which code are you referring to here?
The assembly referencing NuGet.ProjectModel and NuGet.Packaging.Core compiles successfully after removing them.

@paulushub
Copy link

I would be great if the tool is also compiled for .NET 7 so this is not required anymore.

How about using a Docker?

@Apollo3zehn
Copy link
Author

I am referencing to the stack trace in my screenshot above. I'll make a minimum sample on Monday to see if the error is related to my project targeting multiple frameworks (including .NET 6).

Docker would surely work but I think its a bit overkill and I would first like to understand what's going wrong here.

@paulushub
Copy link

paulushub commented Jan 7, 2023

@Apollo3zehn DocFX for .NET 6.x is just trying to make way for a first release, so .NET 7.x will only add more work now.

Here is a thread on managing multiple .NET Core on Linux, if that will be useful:
https://stackoverflow.com/questions/39233865/how-to-install-multiple-versions-of-net-core-side-by-side-on-ubuntu

Many preferred Farvashani's answer, which is detailed here
https://devdojo.com/farvashani/how-to-install-multiple-versions-of-net-core-side-by-side-on-linux

@yufeih yufeih closed this as completed in c641c03 Jan 9, 2023
@Apollo3zehn
Copy link
Author

@paulushub Thank you, it worked.

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

No branches or pull requests

3 participants