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

Automatically update workloads on SDK installation to avoid warning message #17

Open
Aldaviva opened this issue Aug 29, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Aldaviva
Copy link
Owner

  1. Install a package like dotnet-sdk-8.0 version 8.0.401-0 from this repo. This happens both on initial installation and recurs on each minor/patch upgrade.
  2. Run a dotnet command like dotnet build in a project directory
  • Expected: build without warnings
  • Actual: yellow warning message An issue was encountered verifying workloads. For more information, run "dotnet workload update".
ben@pi3:~/HelloWorld $ dotnet build

Welcome to .NET 8.0!
---------------------
SDK Version: 8.0.401

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, view the instructions: https://aka.ms/dotnet-https-linux

----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
An issue was encountered verifying workloads. For more information, run "dotnet workload update".
  Determining projects to restore...
  Restored /home/ben/HelloWorld/HelloWorld.csproj (in 951 ms).
  HelloWorld -> /home/ben/HelloWorld/bin/Debug/net8.0/HelloWorld.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:29.61

This does not break the build, and only really matters if you're trying to build a .NET app for Android, iOS, or Mac OS. Normal CLI programs build fine without this.

Note that the dotnet workload update command requires an Internet connection and superuser permissions to run.

Maybe dotnet workload update could be added to a post-installation script in the SDK .deb files?

@Aldaviva Aldaviva added the enhancement New feature or request label Aug 29, 2024
@Aldaviva Aldaviva self-assigned this Aug 29, 2024
@Aldaviva
Copy link
Owner Author

Trying to actually update the zero workloads I have installed results in the following failure:

Warning: Workload garbage collection failed with error: Workload version 8.0.401-baseline.24412.2 was not found..
$ sudo dotnet workload update --from-previous-sdk

Welcome to .NET 8.0!
---------------------
SDK Version: 8.0.401

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, view the instructions: https://aka.ms/dotnet-https-linux

----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------

Skipping NuGet package signature verification.
Skipping NuGet package signature verification.
Skipping NuGet package signature verification.
Skipping NuGet package signature verification.
Updated advertising manifest microsoft.net.sdk.android.
Updated advertising manifest microsoft.net.workload.emscripten.net6.
Updated advertising manifest microsoft.net.sdk.maui.
Updated advertising manifest microsoft.net.workload.mono.toolchain.current.
Updated advertising manifest microsoft.net.sdk.ios.
Updated advertising manifest microsoft.net.sdk.macos.
Updated advertising manifest microsoft.net.workload.emscripten.current.
Updated advertising manifest microsoft.net.workload.mono.toolchain.net7.
Updated advertising manifest microsoft.net.sdk.aspire.
Updated advertising manifest microsoft.net.sdk.tvos.
Updated advertising manifest microsoft.net.sdk.maccatalyst.
Updated advertising manifest microsoft.net.workload.emscripten.net7.
Updated advertising manifest microsoft.net.workload.mono.toolchain.net6.
No workloads installed for this feature band. To update workloads installed with earlier SDK versions, include the --from-previous-sdk option.
Warning: Workload garbage collection failed with error: Workload version 8.0.401-baseline.24412.2 was not found..

Successfully updated workload(s): .

The same result is output if the --from-previous-sdk argument is passed.

@Aldaviva
Copy link
Owner Author

Aldaviva commented Sep 8, 2024

Related: the manifests leave files behind after the SDK package is uninstalled.

Removing dotnet-sdk-8.0 (8.0.401-0) ...
dpkg: warning: while removing dotnet-sdk-8.0, directory '/usr/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.maui' not empty so not removed
dpkg: warning: while removing dotnet-sdk-8.0, directory '/usr/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.aspire' not empty so not removed
dpkg: warning: while removing dotnet-sdk-8.0, directory '/usr/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.macos' not empty so not removed
dpkg: warning: while removing dotnet-sdk-8.0, directory '/usr/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.ios' not empty so not removed
dpkg: warning: while removing dotnet-sdk-8.0, directory '/usr/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.maccatalyst' not empty so not removed
dpkg: warning: while removing dotnet-sdk-8.0, directory '/usr/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.tvos' not empty so not removed
dpkg: warning: while removing dotnet-sdk-8.0, directory '/usr/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.android' not empty so not removed

@Aldaviva Aldaviva closed this as completed Sep 8, 2024
@Aldaviva Aldaviva reopened this Sep 8, 2024
@Aldaviva Aldaviva removed their assignment Oct 14, 2024
@Aldaviva
Copy link
Owner Author

Aldaviva commented Dec 31, 2024

To configure .NET SDK to install workload files in a user's directory instead of a system-wide directory, you can create an empty file called /usr/share/dotnet/metadata/workloads/9.0.100/userlocal (assuming the SDK version is 9.0.101 or whatever).

A distribution can create an empty /metadata/workloads/<sdkfeatureband>/userlocal file if workloads should be installed under a user path rather than in the dotnet folder. For more information, see GitHub issue dotnet/installer#12104.

Determining the SDK feature band (9.0.100) from the SDK version (9.0.101) may be a little tricky, involving version number manipulation (round patch version down to nearest 100).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant