-
Notifications
You must be signed in to change notification settings - Fork 266
Description
This was raised during development of dotnet tools. The decision was "try to use a temp project and restore the package for now". However, after using this mechanism for 2 years. We still wish to have a C# API to do restore, especially considering we would reuse the dotnet tool install component to install dotnet SDK workloads. Dotnet SDK workloads installation experience needs to be bulletproof or the user will be blocked using Xamarin.
Issues for existing temp project approach
-
Multiple IO operation and process hops caused unreliability and they are very hard to reproduce and resolve. First a file needs to be written to the disk. And a restore in a separate process need to write more files. The following 2 issues are likely caused by race conditions. However, I cannot reproduce them. The cleanup of the temporary files is also tricky.
b. Failed to install tool package ... · Issue #11459 · dotnet/sdk (github.com)
-
Hard-to-act-on error messages. Because the communication between SDK and nuget restore is via the command line. When error happens, SDK can only redirect the output of nuget and SDK cannot give a more specific guidance for the user to act on. That results the long list of "probably this happened." https://docs.microsoft.com/en-us/dotnet/core/tools/troubleshoot-usage-issues#executable-file-not-found
-
Environment leak in. Because there is an explicit msbuild run. Environment variables get leaked in. There is no good way to prevent them.
-
Escape unescaped madness. Because the communication is done via the command line. SDK need to carefully escape/unescape characters. It is not trivial and error prone.
Requirement
It should be a replacement for the temp project. It should select correct TFM and generate asset.json. However, if we can get an API that can simply download package to a specific location, that would fit net6.0 requirement. But it won't help us making tools experience better.