-
Notifications
You must be signed in to change notification settings - Fork 675
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
Try to find a valid dotnet version from the path before falling back to runtime extension #6074
Changes from 2 commits
4f754ba
8c51451
5f157e2
601f759
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ export async function getDotnetInfo(dotNetCliPaths: string[]): Promise<DotnetInf | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file uses --info. --info is not meant for automation and does not have a guaranteed format. The recommendation is to use --list-runtimes and --list-sdks. If there is data you need that is not avaialble in those existing commands, please let us know and we can look into additional stable, machine readable options that are not --info. CC @elinor-fung @vitek-karas since the work would come out of the host to add new information/commands potentially. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can probably replace the version lookup using the --list-sdks command with some work. However we also read the runtimeid (for the debugger) and the architecture (for this PR) which don't appear to be in either of those commands. Generally I would like to avoid needing to parse dotnet info as well - and once the new version of the sdk acquisition extension is available I will likely be able to remove the part of the code I'm adding here. I'm not so sure about the other use cases like the debugger (cc @gregg-miskelly). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the debugger, we are trying to check the version and architecture of the globally installed .NET, as we need the one the application is going to run on. If we want to switch the target app to run on the version of .NET that the acquisition extension downloads, we could probably get rid of the check. But There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking about it more: as long as we provide a way to specify a .NET SDK in the extension, we probably are going to need a way to check the architecture. |
||
let version: string | undefined; | ||
let runtimeId: string | undefined; | ||
let architecture: string | undefined; | ||
|
||
const lines = data.replace(/\r/gm, '').split('\n'); | ||
for (const line of lines) { | ||
|
@@ -33,6 +34,8 @@ export async function getDotnetInfo(dotNetCliPaths: string[]): Promise<DotnetInf | |
version = match[1]; | ||
} else if ((match = /^ RID:\s*([\w\-.]+)$/.exec(line))) { | ||
runtimeId = match[1]; | ||
} else if ((match = /^\s*Architecture:\s*(.*)/.exec(line))) { | ||
architecture = match[1]; | ||
} | ||
} | ||
|
||
|
@@ -42,6 +45,7 @@ export async function getDotnetInfo(dotNetCliPaths: string[]): Promise<DotnetInf | |
FullInfo: fullInfo, | ||
Version: version, | ||
RuntimeId: runtimeId, | ||
Architecture: architecture, | ||
}; | ||
return _dotnetInfo; | ||
} | ||
|
@@ -73,4 +77,5 @@ export interface DotnetInfo { | |
Version: string; | ||
/* a runtime-only install of dotnet will not output a runtimeId in dotnet --info. */ | ||
RuntimeId?: string; | ||
Architecture?: string; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything before here is the exact code O# uses which has been working