-
Notifications
You must be signed in to change notification settings - Fork 73
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
Execution fails when using dotnet 7.x or 8.x to target net6.0 project #687
Comments
Hi @plainionist thanks for reporting this bug! Can you try running FSharpLint with dotnet 6.x instead of with dotnet 8.x? Just to see if it's a valid workaround. |
i tried
but got exactly same error.
|
Shouldn't the fx-version flag be after dotnet and before fsharplint? |
@knocte that's correct - the CLI parser used by the .NET Runtime (not the SDK) is very simplistic and only accepts flags between |
even though you are right according to dotnet help, it doesn't seem to work for tools dotnet --fx-version 6.0.9 fsharplint lint system\Bake\Bake\Bake.fsproj Could not execute because the specified command or file was not found.
|
Oh bummer! Then do you mind uninstalling 8.0.100 and try? This way it will run with 6.x or 7.x. |
After having uninstalled .NET 8 SDK, .NET 7 has been taken - unsuccessfully
Lint failed while analysing system\Bake\Bake\Bake.fsproj. Basically same error message just different verison of System.Runtime not found |
After having uninstalled .NET 7 SDK as well, finally, FSharpLint was executed successfully 👍 |
Oh, so with .NET6 it works? What version of .NET6 do you have? |
yes - works with .NET 6 - i have following versions installed dotnet --info Runtime Environment: global.json file: Host: .NET SDKs installed: .NET runtimes installed: Download .NET: Learn about .NET Runtimes and SDKs: but i would prefer being able to install .NET 8 again and still use FSharpLint 😉 |
Of course, I never stated that this is not a bug. I was trying to see if there's a workaround so that we understand the bug better. I might push a commit later today that might or not help with this bug; I will let you know so you can test a pre-release. |
Upgrade Ionide.ProjInfo to version 0.61.3 so that more project files can be processed by FSharpLint (e.g. the new one introduced in PR#637 which cannot somehow be recognized without this update). Also, this might help with issue #687 given that the stacktrace from its crash comes from our ProjInfo dependency. Note: `dotnet paket update --keep-patch` command was used to update paket.lock file after changing the paket.references file.
@plainionist an update was pushed to nuget, can you test new prerelease version "0.24.1--date20240129-0357.git-d05ca87" please? |
dotnet tool update -g dotnet-fsharplint --prerelease executed with only .NET 6 installed Host: .NET SDKs installed: .NET runtimes installed: and finally got same error again :( dotnet fsharplint lint system\Bake\Bake\Bake.fsproj |
Ok I tried to reproduce this bug, using dotnet 7.x (in particular 7.0.115), and with the default fsproj generated by the command @plainionist can you try to reproduce with the same |
i can try later - meanwhile here is the content of the project i used for testing - maybe this helps (compile elements removed)
|
With this I still can't reproduce it. Note I'm testing in Linux. |
i am testing on windows and even with "default f# classlib template" i get:
|
I have the same issue, but I have an .net8.0 project. System.Runtime, Version=8.0.0.0 missing. |
We have managed to reproduce the problem in CI: https://github.com/webwarrior-ws/FSharpLint/commits/reproduce-687/ The tricky thing will be to fix it. Maybe switching to .net8.0 is our best bet, but:
Help welcome :) |
As a test, I tried setting the roll forward behaviour for the fsharplint tool to Note: When I tried it with the 0.24.0 release it didn't produce any results (which sounds like #690), but using the latest preview release worked. |
I have the same issue |
@xperiandri Does it work if you do
before running fsharplint (using version 0.24.2) ? |
I had the same issue using .Net 8 on Linux. Using |
refs fsprojects#687, whereby it appears to not be able to process .NET 7 or 8 projects when running on .NET 6, and always using the latest version seems to help. It looks like the current roll foward behaviour was added for fsprojects#519 to fix issues where only a newer version than the tool was built with is available, but this change would make it just use the latest all the time (so for example, if you have 6 and 8 installed, then it will use 8 all the time).
Workaround:
Then you can run FSharpLint. And after results delete the file. |
This is an open issue (fsprojects/FSharpLint#687) but a workaround suggesting the use of an earlier version is mentioned as the last comment (fsprojects/FSharpLint#687 (comment)).
just to confirm @Thorium - that would require installing 6.0.403 too? My problem is a bit different - i want to simply run it in dotnet8 and target dotnet8, but get the same error. |
Is this question for Fake or FSharpLint? This is bit complex because Fake build (wrapper) is different from dotnet.exe (actual compile). So after latest Fake 6 update, the .NET6 runtime is needed to run Fake and then you can add NET8 runtime if you want to run dotnet.exe compile on .Net 8 targetframework. What comes to the project e.g. FSharpLint, you can compile that to "only net8" targetframework with this setup in the PR and then the tool enduser only needs NET8. |
I installed F# lint as dotnet tool as described in the documentation (version 0.24.0) and then tried to run it for a single fsproj on the command line like this:
dotnet fsharplint lint TheProject.fsproj
and i got:
Lint failed while analysing system\Bake\Bake\Bake.fsproj.
Failed with: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Stack trace: at Ionide.ProjInfo.ProjectLoader.loadProject(String path, BinaryLogGeneration binaryLogs, FSharpList
1 globalProperties) at Ionide.ProjInfo.ProjectLoader.getProjectInfo(String path, FSharpList
1 globalProperties, BinaryLogGeneration binaryLogs, FSharpList1 customProperties) in /_//src/Ionide.ProjInfo/Library.fs:line 641 at <StartupCode$Ionide-ProjInfo>.$Library.loadProject@906(WorkspaceLoader __, FSharpList
1 customProperties, BinaryLogGeneration binaryLogs, Dictionary2 cache, String p) in /_//src/Ionide.ProjInfo/Library.fs:line 907 at <StartupCode$Ionide-ProjInfo>.$Library.loadProjectList@934(WorkspaceLoader __, FSharpList
1 customProperties, BinaryLogGeneration binaryLogs, Dictionary2 cache, FSharpList
1 projectList) in ///src/Ionide.ProjInfo/Library.fs:line 944at Ionide.ProjInfo.WorkspaceLoader.Ionide.ProjInfo.IWorkspaceLoader.LoadProjects(FSharpList
1 projects, FSharpList
1 customProperties, BinaryLogGeneration binaryLogs) in ///src/Ionide.ProjInfo/Library.fs:line 952at FSharpLint.Application.Lint.getProjectInfo(String projectFilePath, ToolsPath toolsPath) in /home/runner/work/FSharpLint/FSharpLint/src/FSharpLint.Core/Application/Lint.fs:line 301
at FSharpLint.Application.Lint.lintProject$cont@396(OptionalLintParameters optionalParams, String projectFilePath, ToolsPath toolsPath, Unit unitVar) in /home/runner/work/FSharpLint/FSharpLint/src/FSharpLint.Core/Application/Lint.fs:line 440
at FSharpLint.Application.Lint.lintProject(OptionalLintParameters optionalParams, String projectFilePath, ToolsPath toolsPath) in /home/runner/work/FSharpLint/FSharpLint/src/FSharpLint.Core/Application/Lint.fs:line 395
at FSharpLint.Console.Program.start(ParseResults`1 arguments, ToolsPath toolsPath) in /home/runner/work/FSharpLint/FSharpLint/src/FSharpLint.Console/Program.fs:line 133
Operating System: Window 10
dotnet --info
.NET SDK:
Version: 8.0.101
Commit: 6eceda187b
Workload version: 8.0.100-manifests.69afb982
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.101\
.NET workloads installed:
Workload version: 8.0.100-manifests.69afb982
There are no installed workloads to display.
Host:
Version: 8.0.1
Architecture: x64
Commit: bf5e279d92
.NET SDKs installed:
5.0.301 [C:\Program Files\dotnet\sdk]
6.0.400 [C:\Program Files\dotnet\sdk]
6.0.401 [C:\Program Files\dotnet\sdk]
7.0.202 [C:\Program Files\dotnet\sdk]
8.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
arm64 [C:\Program Files\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\arm64\InstallLocation]
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
The text was updated successfully, but these errors were encountered: