Problems with running F# tests locally with .Net7

Hi, I’ve just tried to solve the first fsharp exercise. The solution works, but I cannot run this locally, apparently there are some packages missing, but I’ve followed the instructions on the track documentation.

Here’s the error message (in German, but hopefully still helpful):

warning NU1603: “LuciansLusciousLasagna” is
t von “Microsoft.NET.Test.Sdk (>= 16.8.3)” abhängig, “Microsoft.NET.Test.Sdk 16.8.3” wurde jedoch nicht gefunden. Die ungefähre höc
hste Übereinstimmung von “Microsoft.NET.Test.Sdk 16.11.0” wurde aufgelöst.
C:\Users\denis\Exercism\fsharp\lucians-luscious-lasagna\LuciansLusciousLasagna.fsproj : error NU1101: Das Paket “xunit” wurde nicht
gefunden. Es sind keine Pakete mit dieser ID in folgenden Quellen vorhanden: C:\Program Files\dotnet\sdk\7.0.101\FSharp\library-pa
cks, Microsoft Visual Studio Offline Packages
C:\Users\denis\Exercism\fsharp\lucians-luscious-lasagna\LuciansLusciousLasagna.fsproj : error NU1101: Das Paket “xunit.runner.visua
lstudio” wurde nicht gefunden. Es sind keine Pakete mit dieser ID in folgenden Quellen vorhanden: C:\Program Files\dotnet\sdk\7.0.1
01\FSharp\library-packs, Microsoft Visual Studio Offline Packages
C:\Users\denis\Exercism\fsharp\lucians-luscious-lasagna\LuciansLusciousLasagna.fsproj : error NU1101: Das Paket “FsUnit.xUnit” wurd
e nicht gefunden. Es sind keine Pakete mit dieser ID in folgenden Quellen vorhanden: C:\Program Files\dotnet\sdk\7.0.101\FSharp\lib
rary-packs, Microsoft Visual Studio Offline Packages
C:\Users\denis\Exercism\fsharp\lucians-luscious-lasagna\LuciansLusciousLasagna.fsproj : error NU1101: Das Paket “Exercism.Tests” wu
rde nicht gefunden. Es sind keine Pakete mit dieser ID in folgenden Quellen vorhanden: C:\Program Files\dotnet\sdk\7.0.101\FSharp\l
ibrary-packs, Microsoft Visual Studio Offline Packages
C:\Users\denis\Exercism\fsharp\lucians-luscious-lasagna\LuciansLusciousLasagna.fsproj : error NU1102: Das Paket “NuGet.Frameworks”
der Version (>= 5.0.0) wurde nicht gefunden.
C:\Users\denis\Exercism\fsharp\lucians-luscious-lasagna\LuciansLusciousLasagna.fsproj : error NU1102: - 1 Version(en) gefunden in
“Microsoft Visual Studio Offline Packages” [ Nächste Version: 4.6.4 ]
C:\Users\denis\Exercism\fsharp\lucians-luscious-lasagna\LuciansLusciousLasagna.fsproj : error NU1102: - 0 Version(en) gefunden in
C:\Program Files\dotnet\sdk\7.0.101\FSharp\library-packs.

Maybe it’s relevant: I’ve had dotnet installed before, but in version 6. I’ve updated to version 7 after downloading the exercise. Maybe that’s relevant. (I’ve just realized that another tutorial exercise that used to work before doesn’t work anymore…)

Does anyone know how I can make this work?

Addendum: I’ve managed to make the local tutorial script to run again by adjusting the target in the .fsproj file. (I’m not sure whether this should be necessary… Shouldn’t the continue to work on old targets?)

But in the exercism exercise the target is already correct and it still does not run… Do I have to do anything to manually install the testing frameworks?

@ErikSchierboom sorry to bother you directly, but maybe you know what’s to do in this situation? Any help would be highly appreciated.

Those look like odd error messages. They seem to imply that .NET 7.0 is not installed correctly. Maybe you could try re-installing? Download .NET (Linux, macOS, and Windows)

After you’ve done that, please run dotnet --version and dotnet --list-sdks.

Thanks for the response. The weird thing is that all works. I’ve already tried repairing the installation. No change… Is that possibly caused by having both Visual Studio and dotnet SDK installed? Could it be a path issue?

I’ll try again after a complete reinstall.

Ok --finally success.

First: completely reinstalling did not help at all, deleting Visual Studio neither. So no need to bother with this.

What did help was deleting the folder c:\users\<account>\AppData\Roaming\NuGet\. Seems like there was soem outdated configuration around…

(For reference: I found this stackoverflow question because I also couldn’t install any package: asp.net mvc - Unable to install packages using dotnet add package - Stack Overflow)

1 Like

Very weird, but glad that you’ve been able to work it out!

I seem to be having the same issue. Weirdly, I had them in another exercise and fixed it by adding type assertions. However I’m currently doing the ledger exercise and I’m getting a failure on the tests even though the string output is identical (As I believe this is a refactor exercise, all of the tests are meant to pass when you first download the solution?)

Here’s an example test output:

FsUnit.Xunit+MatchException : Exception of type 'FsUnit.Xunit+MatchException' was thrown.
Expected: Equals "Date       | Description               | Change       
01/01/2015 | Buy present               |      ($10.00)"
Actual:   "Date       | Description               | Change       
01/01/2015 | Buy present               |      ($10.00)"

Tried the above suggestions, completely removed nuget traces, uninstalled all .NET and reinstalled just the latest .NET 7, still nothing.

That probably is a newline issue. We’ve struggled with that in the past.