Skip to content
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

Could not load file or assembly 'System.Runtime, Version=8.0.0.0 when multiple SDKs are present #197

Closed
nojaf opened this issue Aug 29, 2023 · 2 comments

Comments

@nojaf
Copy link
Contributor

nojaf commented Aug 29, 2023

Describe the bug

fsdocs cannot crack my projects when multiple SDKs are present.

To Reproduce

Create an environment where the following SDKs are installed:

dotnet --list-sdks
7.0.203 [/home/nojaf/.dotnet/sdk]
7.0.305 [/home/nojaf/.dotnet/sdk]
7.0.400-preview.23311.1 [/home/nojaf/.dotnet/sdk]
8.0.100-preview.7.23376.3 [/home/nojaf/.dotnet/sdk]

(I don't know which SDK exactly causes the problem, this is what I had locally in WSL)

Steps to reproduce the behaviour:

Clone https://github.com/dawedawe/fantomas/tree/net8_lang_preview
Run:

#!/bin/bash
dotnet tool restore
dotnet restore
dotnet build -c Release

SMV="$(pwd)/src/Fantomas/bin/Debug/net6.0/SemanticVersioning.dll"
dotnet fsdocs build --clean --properties Configuration=Release --fscoptions " -r:$SMV" --eval --strict --nonpublic

Expected behaviour
Cracking should happen fine.

Screenshots

cracking projects...
  skipping project 'Fantomas.Core.fsproj' because an error occurred while cracking it: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

File name: 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at Ionide.ProjInfo.ProjectLoader.loadProject(String path, BinaryLogGeneration binaryLogs, FSharpList`1 globalProperties)
   at Ionide.ProjInfo.ProjectLoader.getProjectInfo(String path, FSharpList`1 globalProperties, BinaryLogGeneration binaryLogs, FSharpList`1 customProperties) in /_//src/Ionide.ProjInfo/Library.fs:line 842
   at fsdocs.Crack.crackProjectFileAndIncludeTargetFrameworks[a](a _slnDir, FSharpList`1 extraMsbuildProperties, String projectFile) in /home/runner/work/FSharp.Formatting/FSharp.Formatting/src/fsdocs-tool/ProjectCracker.fs:line 268
   at fsdocs.Crack.crackProjectFile[a](a slnDir, FSharpList`1 extraMsbuildProperties, String file) in /home/runner/work/FSharp.Formatting/FSharp.Formatting/src/fsdocs-tool/ProjectCracker.fs:line 348
   at [email protected](String p) in /home/runner/work/FSharp.Formatting/FSharp.Formatting/src/fsdocs-tool/ProjectCracker.fs:line 453
Project cracking failed and --strict is on, exiting

Environment (please complete the following information):

  • OS: WSL (Ubuntu 22.04.2 LTS)
  • Ionide version: /
  • VSCode version: /
  • dotnet SDK version: 8.0.100-preview.7.23376.3
  • mono / .Net Framework version: /

Additional context
This problem doesn't occur when running this inside the docker image:

docker run -it --rm `
  -v ${PWD}:/app `
  -w /app `
  mcr.microsoft.com/dotnet/sdk:8.0-preview `
  pwsh

# dotnet --list-sdks      
# 8.0.100-preview.7.23376.3 [/usr/share/dotnet/sdk]

dotnet tool restore
dotnet restore
dotnet build -c Release

$SMV="$(pwd)/src/Fantomas/bin/Debug/net6.0/SemanticVersioning.dll"

dotnet fsdocs build --clean --properties Configuration=Release --fscoptions " -r:$SMV" --eval --strict --nonpublic

When only the preview SDK is present, this is not a problem.

I also ensured that #195 is unrelated to this problem space.

@nojaf
Copy link
Contributor Author

nojaf commented Aug 31, 2023

Turns out that while using the preview SDK it helps to use these environment variables:

$env:DOTNET_ROLL_FORWARD_TO_PRERELEASE = 1
$env:DOTNET_ROLL_FORWARD = LatestMajor

I was facing a runtime issue and nothing with the inner workings of proj-info.

@nojaf nojaf closed this as completed Aug 31, 2023
@nojaf
Copy link
Contributor Author

nojaf commented Aug 31, 2023

Thanks again @TheAngryByrd for pointing this out!

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

No branches or pull requests

1 participant