./build.ps1 -Clobber
Builds PSScriptAnalyzer
> ./build.ps1 -Clobber
WARNING: Cannot convert ' 2.2.402 [/usr/share/dotnet/sdk]' to portable version
WARNING: Cannot convert ' 3.0.100 [/usr/share/dotnet/sdk]' to portable version
WARNING: Cannot convert ' 2.2.402 [/usr/share/dotnet/sdk]' to portable version
WARNING: Cannot convert ' 3.0.100 [/usr/share/dotnet/sdk]' to portable version
dotnet-install: .NET Core SDK version 2.2.104 is already installed. dotnet-install: Adding to current process PATH: `/home/rob/.dotnet`. Note: This change will be visible only when sourcing script. dotnet-install: Installation finished successfully.
WARNING: Cannot convert ' 2.2.402 [/usr/share/dotnet/sdk]' to portable version
WARNING: Cannot convert ' 3.0.100 [/usr/share/dotnet/sdk]' to portable version
WARNING: Cannot convert ' 2.2.402 [/usr/share/dotnet/sdk]' to portable version
WARNING: Cannot convert ' 3.0.100 [/usr/share/dotnet/sdk]' to portable version
WARNING: No suitable dotnet CLI found, requires version '0002.0002.0104' found only ''
WARNING: A compatible installed .NET Core SDK for global.json version [2.2.104] from [/home/rob/Documents/Dev/Microsoft/PSScriptAnalyzer/global.json] was not found Install the [2.2.104] .NET Core SDK or update [/home/rob/Documents/Dev/Microsoft/PSScriptAnalyzer/global.json] with an installed .NET Core SDK: 2.2.402 [/usr/share/dotnet/sdk] 3.0.100 [/usr/share/dotnet/sdk]
Start-ScriptAnalyzerBuild: /home/rob/Documents/Dev/Microsoft/PSScriptAnalyzer/build.ps1 Line | 68 | Start-ScriptAnalyzerBuild @buildArgs | ^ Failure to build for PSVersion '6' using | framework 'netstandard2.0' and configuration 'PSV6Debug'
> $PSVersionTable
Name Value
---- -----
PSVersion 7.0.0-preview.5
PSEdition Core
GitCommitId 7.0.0-preview.5
OS Linux 4.15.0-65-generic #74-Ubuntu S…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
I've restrained myself from reporting this before, but I don't like having to delete the global.json every time I want to build PSScriptAnalyzer.
In this case, I've gone out of my way to make sure the right dotnet sdk version is installed, and in the build script it's even reported that it's there. But then the build fails because the version doesn't match.
Naturally on Ubuntu I don't have Visual Studio, so I need to build with the build script and use VSCode, but I feel like I've hit this SDK version issue every time I build PSSA and feel like we should maybe address it.
Note that I installed dotnet on Ubuntu with sudo apt install dotnet-sdk-2.2, which is the most granular version offered
Can you please try to use the Invoke-AppVeyorInstall bootstrapper function in appveyor.psm1 (that we use in CI only but I think would be fine for developer purposes as well)? You might need to re-start the shell the first time you use it due to the PATH change but otherwise it should install the right dotnet version for you.
https://github.com/PowerShell/PSScriptAnalyzer/blob/master/tools/appveyor.psm1#L7
I don't have good experience with the bootstrap and .net version detection code that James wrote either, it's too over-engineered and does not work well (and even worse, kept breaking whilst being hard to debug, hence why I changed CI to use my original appveyor bootstrapping code instead. If it turns out that the appveyor code works well, then we should replace Jame's code with it IMHO.
Otherwise: Since a lot of the PowerShell repos all have the same problem with the dotnetbootstrapping (and all solve it differently with custom code), it would be worthwhile to make a generic module and publish that on the PSGallery.
Hmm Invoke-AppVeyorInstall mangled the PATH and lost git, causing it to error out. But it's also configured to install/overwrite modules on the installing system.
@rjmholt Is this still happening?
Just pulled master and am able to build again