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

Notification

Icon
Error

Issue building project using tools NuGet package
richardmoss
#1 Posted : Saturday, January 4, 2020 3:36:11 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/1/2012(UTC)
Posts: 12

Thanks: 3 times
Was thanked: 4 time(s) in 4 post(s)
Hello,

I am currently using the StrongNameSigner tool, a NuGet package which doesn't add any references, but injects a tool into the build process which automatically applies a strong name signature to any assemblies without one, given that I still strong name all my own assemblies but this is making it a nightmare trying to work with third party libraries that aren't strong named. The use of this package has been working well for me for the last week or so.

Next I started adding tests for some of the assemblies which reference this package (either directly or indirectly via another reference) and more often than not, NCrunch will fail to build the project, printing out errors similar to the following (mostly the former, only occasionally the latter)

Code:
..\..\..\..\..\packages\Brutal.Dev.StrongNameSigner.2.7.1\build\Brutal.Dev.StrongNameSigner.targets (6, 5): FileNotFoundException: Could not load file or assembly 'Mono.Cecil, 
Version=0.11.1.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e' or one of its dependencies. The system cannot find the file specified.
   at Brutal.Dev.StrongNameSigner.SigningHelper.GetAssemblyInfo(String assemblyPath, String[] probingPaths)
   at Brutal.Dev.StrongNameSigner.AutomaticBuildTask.Execute()


or

Code:
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: 
FileNotFoundException: Could not load file or assembly 'Mono.Cecil, Version=0.11.1.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e' or one of its dependencies.
 The system cannot find the file specified.
   at Brutal.Dev.StrongNameSigner.SigningHelper.GetAssemblyInfo(String assemblyPath, String[] probingPaths)
   at Brutal.Dev.StrongNameSigner.AutomaticBuildTask.Execute()

   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 , EffectiveProcessorArchitecture , GridClientId , BuildSystemParameters , IList`1 , Nullable`1 , GridAddress )
   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, VisualStudioVersion vsVersion, ComponentUniqueName componentName, TaskSettings componentTaskSettings, 
Exception parseException, String targetFramework)
..\..\..\..\..\packages\Brutal.Dev.StrongNameSigner.2.7.1\build\Brutal.Dev.StrongNameSigner.targets (6, 5): FileNotFoundException: Could not load file or assembly
 'Mono.Cecil, Version=0.11.1.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e' or one of its dependencies. The system cannot find the file specified.
   at Brutal.Dev.StrongNameSigner.SigningHelper.GetAssemblyInfo(String assemblyPath, String[] probingPaths)
   at Brutal.Dev.StrongNameSigner.AutomaticBuildTask.Execute()


I have already tried setting the "Copy referenced assemblies to workspace" option to "True" for affected projects but as expected it had no effect as this package never adds any references.

On browsing to the NCrunch working directory for a failing project, I could see that the "packages" folder had been generated but only 3 of the StrongNameSigner files were present and there should have been quite a few more (including Mono.Cecil).

I'm not entirely sure if the problem is with NCrunch or this NuGet package I'm using, any suggestions?
Remco
#2 Posted : Saturday, January 4, 2020 10:26:13 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.

I think this is just a case of NCrunch not detecting the dependency on some of the library files stored in the package's directory. Try adding the entire package directory using the 'Additional files to include' setting. This should ensure all the files get copied over to the workspace.
1 user thanked Remco for this useful post.
richardmoss on 1/11/2020(UTC)
richardmoss
#3 Posted : Saturday, January 11, 2020 1:30:02 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/1/2012(UTC)
Posts: 12

Thanks: 3 times
Was thanked: 4 time(s) in 4 post(s)
Hello,

I forgot to get back you, but this works - thanks.

Regards;
Richard Moss
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