Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NCrunch V5 not working for F# projects in Rider
ccc102
#1 Posted : Wednesday, April 17, 2024 2:05:26 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/17/2024(UTC)
Posts: 3
Location: United Kingdom

I'm running 5.6.01 with the latest Rider, but unfortunately any F# projects are not building. This is reproducible by just creating a new F# project in Rider and enabling NCrunch so nothing specific to what I'm doing. All works fine for the Visual Studio version.

NCrunch: If you are experiencing problems in getting this project to build, have a look at https://www.ncrunch.net/...ng_project-build-issues
..\..\..\..\..\Program Files\dotnet\sdk\8.0.204\FSharp\Microsoft.FSharp.Targets (331, 9): The specified task executable location "C:\Program Files\dotnet\sdk\8.0.204\FSharp\fsc.exe" is invalid.


Appreciate the Rider plugin is much more experimental, but really excited to use it (especially as F# support in rider is so good)

Thanks

Remco
#2 Posted : Wednesday, April 17, 2024 11:54:47 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,147

Thanks: 961 times
Was thanked: 1294 time(s) in 1200 post(s)
Hi, thanks for posting.

It looks like the .NET SDK that you're using is somehow missing the fsharp compiler. Can you check through your SDK installations at C:\Program Files\dotnet\sdk to find the latest one that includes fsc.exe? You can then use this with NCrunch by setting the Build Sdk setting.
ccc102
#3 Posted : Thursday, April 18, 2024 7:03:19 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/17/2024(UTC)
Posts: 3
Location: United Kingdom

The .NET sdk doesn't include an f# compiler exe anymore (just fsc.dll). However Visual Studio does as part of a tools folder. NCrunch uses this when running in Visual Studio.

I've found a workaround by adding this Property to Directory.Build.Props to use the Visual Studio fsc.exe

Code:
<FscToolPath Condition="'$(NCrunch)' == '1'">C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools</FscToolPath>


This work for me as I already have Visual studio installed, but obviously not ideal to have this dependency for running in Rider.

When I build F# projects in Rider I can see in the logs that in order to run the f# compiler it runs

Code:
C:\Program Files\dotnet\dotnet.exe "C:\Program Files\dotnet\sdk\8.0.204\FSharp\fsc.dll"


I couldn't work out exactly what MSBuild property Rider is using to enable this build behavior, but I think if this could made the default for NCrunch Rider it would remove the need for Visual Studio workaround.



Remco
#4 Posted : Thursday, April 18, 2024 11:29:15 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,147

Thanks: 961 times
Was thanked: 1294 time(s) in 1200 post(s)
If you set the 'Build Sdk' property to point to VS2022 instead of a version of the .NET SDK, does the problem go away?
ccc102
#5 Posted : Friday, April 19, 2024 10:47:51 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/17/2024(UTC)
Posts: 3
Location: United Kingdom

Yes that works too! (presume in much the same way)

Thanks

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download