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

Notification

Icon
Error

Possible error in GetToolPath
NeilMacMullen
#1 Posted : Thursday, January 27, 2022 4:57:55 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 12/15/2016(UTC)
Posts: 55
Location: United Kingdom

Thanks: 29 times
Was thanked: 12 time(s) in 11 post(s)
I have a C# test project that uses a managed 32bit C++ dll. As a result, the csproj file contains this...

Quote:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>


This worked fine when I was targetting Net5 but under Net6, Ncrunch fails to build the project and reports

Quote:
[PID:23340 16:41:42.5767 LocalBuildTask-150] ERROR (Internal): System.Exception: dotnet.exe was not found at 'C:\Program Files (x86)\dotnet\dotnet.exe'
at nCrunch.Core.PlatformTypes.DotNetCore.DotNetCoreSdk.(EffectiveProcessorArchitecture )
at nCrunch.Core.PlatformTypes.DotNetCore.DotNetCoreSdk.GetToolPath(EffectiveProcessorArchitecture effectiveProcessorArchitecture)
at nCrunch.Core.PlatformTypes.DotNetCore.DotNetCoreSdk.GetFallbackFolderPath(EffectiveProcessorArchitecture processorArchitecture)
at nCrunch.Core.PlatformTypes.DotNetCore.DotNetCoreBuildExtender.(SnapshotComponent , FilePath , DirectoryPath[] )
at nCrunch.Core.PlatformTypes.DotNetCore.DotNetCoreBuildExtender.(SnapshotComponent , BuildOutput )
at nCrunch.Core.PlatformTypes.DotNetCore.DotNetCoreBuildExtender.ProcessSuccessfulBuildOutput(SnapshotComponent component, BuildOutput buildOutput, IList`1 componentReferences)
at nCrunch.Core.BuildManagement.BuildEnvironment.Build(SnapshotComponent snapshotComponentToBuild, IList`1 referencedComponents, GridClientId gridClientId, IList`1 customEnvironmentVariables, IPlatformBuildExtender extender, Guid taskId, GridAddress clientAddress, Boolean extractCoverageReportStructure)
at nCrunch.Core.Processing.BuildTaskLogic.DoProcessTaskAndReturnSuccessFlag()
at nCrunch.Core.Processing.TaskLogic.ProcessTaskAndReturnSuccessFlag()
at nCrunch.Client.Processing.LocalProcessingTask.ProcessTaskAndReturnSuccessFlag()
at nCrunch.Client.Processing.ProcessingQueue..()


However, I believe that this is the wrong location for dotnet 6...

Quote:
16:46/Backend>get-command dotnet

CommandType Name Version Source
----------- ---- ------- ------
Application dotnet.exe 6.0.121.5… C:\Program Files\dotnet\dotnet.exe


If I remove the x86 platform target, Ncrunch successfully builds the project but tests fail because the DLL can't be loaded.


Ncrunch is 4.11.02
VS is 17.0.5 (VS2022, stable)
Remco
#2 Posted : Thursday, January 27, 2022 10:38:47 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for sharing this.

I'm not sure how this worked under Net5, as technically I would have thought it shouldn't. Running a test project set to target x86 defaults in the x86 version of Dotnet being used, which isn't installed on your machine.

It might be possible to work around this by setting your use CPU architecture setting to x64. In this way, NCrunch will use the x64 version of Dotnet for your runtime environment while still building the test project to target x86.

If the above doesn't work, then you'll need to install the x86 version of Dotnet.
1 user thanked Remco for this useful post.
NeilMacMullen on 1/28/2022(UTC)
NeilMacMullen
#3 Posted : Friday, January 28, 2022 10:46:07 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 12/15/2016(UTC)
Posts: 55
Location: United Kingdom

Thanks: 29 times
Was thanked: 12 time(s) in 11 post(s)
>I'm not sure how this worked under Net5, as technically I would have thought it shouldn't.

I think I was probably conflating the migration to Net6 with a move to a new dev machine. It turns out that the project did build and test on the old machine because it had an old x86 Net5 SDK installed. (Not sure how since I only ever consciously install x64 versions but nvm...)


>It might be possible to work around this by setting your use CPU architecture setting to x64.

Unfortunately even after setting both (Build Settings) "Build Process CPU Architecture" and (Test Settings) "use CPU Architecture" to x64 Ncruchs still tries to use the version in "Program Files (x86)"

>If the above doesn't work, then you'll need to install the x86 version of Dotnet.


This did work - 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.034 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download