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

Notification

Icon
Error

AnyCPU Test not working
Dinesh
#1 Posted : Tuesday, September 25, 2018 3:36:10 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/3/2018(UTC)
Posts: 11
Location: United Kingdom

My main project is AnyCPU and so is my test project. Before I did not have the following line in my main project csproj file <PlatformTarget>AnyCPU</PlatformTarget>, once added I get following exception.

System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> nCrunch.Common.UserException: Errors occurred while trying to load the project file:
Assets file 'C:\TestProject\obj\project.assets.json' doesn't have a target for '.NETFramework,Version=v4.6.1/win7-x86'. Ensure that restore has run and that you have included 'net461' in the TargetFrameworks for your project. You may also need to include 'win7-x86' in your project's RuntimeIdentifiers.
at nCrunch.Compiler.ComponentAnalysisContext.()
at nCrunch.Compiler.ComponentAnalysisContext.AnalyseComponentBuild()
at nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.(CallMethodMessage )
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.ProcessMessageReturningResult(Byte[] data)
at nCrunch.TaskRunner.Ipc.RemoteInstance.(Byte[] )
at nCrunch.TaskRunner.Ipc.RemoteInstance.Invoke(IMessage msg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at nCrunch.Compiler.IRemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
at nCrunch.Core.BuildManagement.BuildProcessLauncher..(IRemoteBuildRunner )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , FilePath , String , ExternalProcess )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , ProcessorArchitecture , GridClientId , BuildSystemParameters , IList`1 , Nullable`1 , GridAddress )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(ComponentLoadParameters parameters, IList`1 customEnvironmentVariables)
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(ProcessorArchitecture , String )
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.CreateComponentFromXml(FilePath projectFilePath, ParsedBuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, VisualStudioVersion vsVersion, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFramework)

According to your documentation I can force it to use CPU architecture from AutoDetect to x86, which I've done and still same error.

Please note the test builds successfully using Resharper Test Runner as well as MSTest and NUnit Test Runner, it is just NCrunch that is complaining.



Remco
#2 Posted : Tuesday, September 25, 2018 11:06:23 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for sharing this issue.

This looks like a synchronisation problem between your project.assets.json file and the project as loaded by your IDE.

Try the following steps:

1. Close all instances of VS
2. Browse to the directory of the offending project
3. Delete the 'obj' and 'bin' directories (or rename if you're unsure)
4. Re-open VS and open the solution
5. Wait for VS to regenerate the project.assets.json file. NCrunch should detect it automatically. If not, try resetting the NCrunch engine a few seconds after opening the solution.

The configuration overrides in the documentation won't have any impact on this problem, as it's appearing when NCrunch first loads the project. The overrides all apply to downstream tasks (i.e. building, running tests, etc).
Dinesh
#3 Posted : Wednesday, September 26, 2018 1:50:48 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/3/2018(UTC)
Posts: 11
Location: United Kingdom

Thanks, I don't need to do this anymore so I've removed <PlatformTarget>AnyCPU</PlatformTarget> from my csproj which is what it was before and all good.
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.035 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download