Skip to content

Add new function which checks for the proper version of dotnet #1131

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

Closed

Conversation

JamesWTruher
Copy link
Contributor

This will improve the experience when the wrong version of dotnet is present by creating an error very early on in the process with a better error message

Now the developer will see something similar to the following:

PS /users/james/src/github/forks/JamesWTruher/PSScriptAnalyzer> ./build
Incorrect dotnet version: have '2.1.403' need '2.2.102'
At /users/james/src/github/forks/JamesWTruher/PSScriptAnalyzer/build.psm1:137 char:9
         throw 'Incorrect dotnet version: have '' need ' ...
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 CategoryInfo          : OperationStopped: (Incorrect dotne... need '2.2.102':String) [], RuntimeException
 FullyQualifiedErrorId : Incorrect dotnet version: have '2.1.403' need '2.2.102'

PR Summary

PR Checklist

This will improve the experience when the wrong version of dotnet is present by creating an error very early on in the process with a better error message

Now the developer will see something similar to the following:
```
PS /users/james/src/github/forks/JamesWTruher/PSScriptAnalyzer> ./build
Incorrect dotnet version: have '2.1.403' need '2.2.102'
At /users/james/src/github/forks/JamesWTruher/PSScriptAnalyzer/build.psm1:137 char:9
         throw 'Incorrect dotnet version: have '' need ' ...
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 CategoryInfo          : OperationStopped: (Incorrect dotne... need '2.2.102':String) [], RuntimeException
 FullyQualifiedErrorId : Incorrect dotnet version: have '2.1.403' need '2.2.102'
```
Copy link
Collaborator

@bergmeister bergmeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this to work on the WMF4 build as well (it doesn't at the moment) and we should also remove/move existing code here that is used for CI to avoid duplication. There is a lot of handling for major/minor version, why not use the --list-sdks option instead to avoid handling those scenarios and also to not make it fail and just install the exact required version? In terms of handling the error and minor/major versions, I think dotnet build does that already together with global.json, so we should rather try to just rather try to propagate this error from the layering between build.ps1 and build.psm1 to the user.

@JamesWTruher
Copy link
Contributor Author

i'm closing this and will incorporate it into #1139

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 this pull request may close these issues.

2 participants