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

Notification

Icon
Error

Build fails - net48/win7-x86 not found
Dirk Maegh
#1 Posted : Monday, October 21, 2024 12:00:32 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/30/2016(UTC)
Posts: 55
Location: Belgium

Thanks: 8 times
Was thanked: 8 time(s) in 8 post(s)
Hi,

I am changing a netstandard2.0 library and client to net48;net60;net80.

For the package dependencies I have introduced some conditional ItemGroup on TargetFramework.

All builds run fine in VS2022 Preview - I had set the ncrunch build SDK to 9.0 rc something, but for this solution, I updated it to something fixed and solid - 8.0.403.

My library has these settings
Quote:
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net48;net6.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
...


My client has about the same
Quote:
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net48;net6.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
...


As already mentioned, VS builds fine.
But ncrunch gives me this error
Quote:

System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> Errors occurred while trying to load the project file:
Assets file 'D:\P\xxx\src\Samples\xxx.Client\obj\project.assets.json' doesn't have a target for 'net48/win7-x86'. Ensure that restore has run and that you have included 'net48' in the TargetFrameworks for your project. You may also need to include 'win7-x86' in your project's RuntimeIdentifiers.
--- End of inner exception stack trace ---
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.processCallMethodMessage(CallMethodMessage callMethodMessage)
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.ProcessMessageReturningResult(Byte[] data)
at nCrunch.TaskRunner.Ipc.RemoteProxyCommunicator.(Byte[] )
at nCrunch.TaskRunner.Ipc.RemoteProxyCommunicator.Invoke(String methodName, Object[] args)
at nCrunch.Compiler.RemoteBuildRunnerProxy.AnalyseComponentBuild(ComponentLoadParameters parameters)
at nCrunch.Core.BuildManagement.BuildProcessLauncher..(IRemoteBuildRunner )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , FilePath , String , DirectoryPath , ExternalProcess )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , EffectiveProcessorArchitecture , GridClientId , BuildSystemParameters , IList`1 , Nullable`1 , GridClientDescription , DotNetCoreSdkVersion  )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(ComponentLoadParameters parameters, IList`1 customEnvironmentVariables)
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(EffectiveProcessorArchitecture , String )
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.CreateComponentFromXml(FilePath projectFilePath, ParsedBuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, IDEVersion ideVersion, BuildEngineId buildEngineId, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFrameworkForMsbuild, String visibleTargetFramework)



I can't make sense of "You may also need to include 'win7-x86' in your project's RuntimeIdentifiers."
I can add it I think, but why would I need win7 something ? (I don't want windows 7 - we're on windows 11, if that's relevant)
Remco
#2 Posted : Monday, October 21, 2024 12:34:36 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 956 times
Was thanked: 1284 time(s) in 1191 post(s)
Hi, thanks for sharing this issue.

I think this is being caused by a discrepancy between the build system being used by VS compared with NCrunch.

Most likely the project.assets.json file generated by VS's package restore step has been generated by a different version of the platform to the one NCrunch is using to build the project. This can result in some crazy weird errors. If you're running the preview version of VS, you'll need to make sure the chosen Build SDK for NCrunch is set to the latest preview version of .NET that you have installed. VS2022's .NET resolution logic is different when it is in preview mode (the normal one won't use preview platforms when it resolves).

Note that the Build SDK is not the same as the target framework for the project. It's perfectly fine to have Build SDK set to 9.0 rc, and have it build a .NET 8.0 project. If you want to avoid using preview tooling for this solution, you'll need to avoid using the preview version of VS2022.

1 user thanked Remco for this useful post.
Dirk Maegh on 10/21/2024(UTC)
Dirk Maegh
#4 Posted : Monday, October 21, 2024 1:53:51 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/30/2016(UTC)
Posts: 55
Location: Belgium

Thanks: 8 times
Was thanked: 8 time(s) in 8 post(s)
I have removed the item about ExcludeFromCoverage. After cleaning my projects, I got the same problem from VS. So not an nCrunch issue. I should have been more careful before posting, sorry :)
1 user thanked Dirk Maegh for this useful post.
Remco on 10/21/2024(UTC)
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.038 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download