Project A is C# project.
Project B is a mixed mode (VS 2013) C++ project, defining .Net types, referencing project A.
Project C is a C# project, referencing project A and B.
With NCrunch under VS2013 everything works fine.
VS2015 builds and executes tests without an error
NCrunch under VS 2015 displays build errors for project C, when referencing types defined in project B.
"The name ... is not available in the current context."
Any idea why this happens?
Regards
Wilhelm
Build/Test Issues
C++ types not available in C# under VS2015
Started by wilhelmmedetz on 6,569 views
Remco NCrunch Developer
#7555
30 Jul 2015 12:03 UTC
Hi Wilhelm,
Unfortunately I can't think of any reason off the top of my head as to why this would happen. Do you have any sample code that you might be able to share? I may have more luck with a solution that can reproduce the issue.
Unfortunately I can't think of any reason off the top of my head as to why this would happen. Do you have any sample code that you might be able to share? I may have more luck with a solution that can reproduce the issue.
Hi,
I could reproduce this with a simple example (ProjectA is not needed).
It works with VS2013.
It fails with VS 2015.
Building ProjectB creates an error - see below.
There also is a second problem - when deselecting 'Show passing tests' only the build error for ProjectC is displayed.
When selecting 'Show passing tests' build errors are displayed for PrjectB and ProjectC.
Is there any place where I can upload the solution?
System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> nCrunch.Common.UserException: Errors occurred while trying to load the project file:
Die "SetEnv"-Aufgabe konnte nicht aus der "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Build.CppTasks.Common.dll"-Assembly instanziiert werden. Überprüfen Sie, ob die Aufgabenassembly mit der gleichen Version der Microsoft.Build.Framework-Assembly erstellt wurde, die auf Ihrem Computer installiert ist, und dass Ihrer Hostanwendung kein BindingRedirect-Eintrag für Microsoft.Build.Framework fehlt. Das Objekt des Typs "Microsoft.Build.CPPTasks.SetEnv" kann nicht in Typ "Microsoft.Build.Framework.ITask" umgewandelt werden.
Die SetEnv-Aufgabe wurde falsch deklariert, falsch verwendet oder konnte bei der Erstellung nicht ausgeführt werden. Überprüfen Sie die Schreibweise des Aufgaben- und des Assemblynamens.
bei nCrunch.Compiler.RemoteBuildRunner.(FilePath , , String , String , DirectoryPath , String )
bei nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(FilePath projectFilePath, BuildXml buildXml, String useBuildConfiguration, String useBuildPlatform, DirectoryPath solutionDir, String solutionName, List`1 importExpressionsToEvaluate)
--- Ende der internen Ausnahmestapelüberwachung ---
bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
bei nCrunch.TaskRunner.Ipc.IpcMessageProcessor.(CallMethodMessage )
bei nCrunch.TaskRunner.Ipc.IpcMessageProcessor.ProcessMessageReturningResult(Byte[] data)
bei nCrunch.TaskRunner.Ipc.RemoteInstance.[T](Byte[] )
bei nCrunch.TaskRunner.Ipc.RemoteInstance.Invoke(IMessage msg)
bei System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
bei nCrunch.Compiler.IRemoteBuildRunner.AnalyseComponentBuild(FilePath projectFilePath, BuildXml buildXml, String useBuildConfiguration, String useBuildPlatform, DirectoryPath solutionDir, String solutionName, List`1 importExpressionsToEvaluate)
bei nCrunch.Core.BuildManagement.BuildProcessLauncher..(IRemoteBuildRunner )
bei nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , ProcessorArchitecture , GridClientId , IBuildableProject , CustomEnvironmentVariable[] )
bei nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(FilePath projectFilePath, BuildXml buildXml, String useBuildConfiguration, String useBuildPlatform, DirectoryPath solutionDir, String solutionName, List`1 importExpressionsToEvaluate, ProcessorArchitecture processorArchitecture, VisualStudioVersion vsVersion, CustomEnvironmentVariable[] customEnvironmentVariables)
bei nCrunch.Client.ComponentLoader.SnapshotComponentFactory.(ProcessorArchitecture )
bei nCrunch.Client.ComponentLoader.SnapshotComponentFactory.CreateSnapshotComponentFromXml(FilePath projectFilePath, BuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, ISnapshotConfig snapshotConfig, VisualStudioVersion vsVersion)
I could reproduce this with a simple example (ProjectA is not needed).
It works with VS2013.
It fails with VS 2015.
Building ProjectB creates an error - see below.
There also is a second problem - when deselecting 'Show passing tests' only the build error for ProjectC is displayed.
When selecting 'Show passing tests' build errors are displayed for PrjectB and ProjectC.
Is there any place where I can upload the solution?
System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> nCrunch.Common.UserException: Errors occurred while trying to load the project file:
Die "SetEnv"-Aufgabe konnte nicht aus der "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Build.CppTasks.Common.dll"-Assembly instanziiert werden. Überprüfen Sie, ob die Aufgabenassembly mit der gleichen Version der Microsoft.Build.Framework-Assembly erstellt wurde, die auf Ihrem Computer installiert ist, und dass Ihrer Hostanwendung kein BindingRedirect-Eintrag für Microsoft.Build.Framework fehlt. Das Objekt des Typs "Microsoft.Build.CPPTasks.SetEnv" kann nicht in Typ "Microsoft.Build.Framework.ITask" umgewandelt werden.
Die SetEnv-Aufgabe wurde falsch deklariert, falsch verwendet oder konnte bei der Erstellung nicht ausgeführt werden. Überprüfen Sie die Schreibweise des Aufgaben- und des Assemblynamens.
bei nCrunch.Compiler.RemoteBuildRunner.(FilePath , , String , String , DirectoryPath , String )
bei nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(FilePath projectFilePath, BuildXml buildXml, String useBuildConfiguration, String useBuildPlatform, DirectoryPath solutionDir, String solutionName, List`1 importExpressionsToEvaluate)
--- Ende der internen Ausnahmestapelüberwachung ---
bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
bei nCrunch.TaskRunner.Ipc.IpcMessageProcessor.(CallMethodMessage )
bei nCrunch.TaskRunner.Ipc.IpcMessageProcessor.ProcessMessageReturningResult(Byte[] data)
bei nCrunch.TaskRunner.Ipc.RemoteInstance.[T](Byte[] )
bei nCrunch.TaskRunner.Ipc.RemoteInstance.Invoke(IMessage msg)
bei System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
bei nCrunch.Compiler.IRemoteBuildRunner.AnalyseComponentBuild(FilePath projectFilePath, BuildXml buildXml, String useBuildConfiguration, String useBuildPlatform, DirectoryPath solutionDir, String solutionName, List`1 importExpressionsToEvaluate)
bei nCrunch.Core.BuildManagement.BuildProcessLauncher..(IRemoteBuildRunner )
bei nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , ProcessorArchitecture , GridClientId , IBuildableProject , CustomEnvironmentVariable[] )
bei nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(FilePath projectFilePath, BuildXml buildXml, String useBuildConfiguration, String useBuildPlatform, DirectoryPath solutionDir, String solutionName, List`1 importExpressionsToEvaluate, ProcessorArchitecture processorArchitecture, VisualStudioVersion vsVersion, CustomEnvironmentVariable[] customEnvironmentVariables)
bei nCrunch.Client.ComponentLoader.SnapshotComponentFactory.(ProcessorArchitecture )
bei nCrunch.Client.ComponentLoader.SnapshotComponentFactory.CreateSnapshotComponentFromXml(FilePath projectFilePath, BuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, ISnapshotConfig snapshotConfig, VisualStudioVersion vsVersion)
Remco NCrunch Developer
#7561
30 Jul 2015 23:05 UTC
Thanks for sharing the extra details. It looks like VS2015 introduced a new range of binding redirections to allow its build process to work correctly with tasks built against older frameworks.
Go to your NCrunch installation (usually C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2015). Look for a file called 'nCrunch.build.14.0.config'. Open the file, and look for a bunch of binding redirections like the following:
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-4.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-4.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-4.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
... Remove these, and replace them with the following:
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-12.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-12.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-12.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Conversion.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-12.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Tasks.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-12.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Utilities.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-12.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
Does this solve the issue?
Go to your NCrunch installation (usually C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2015). Look for a file called 'nCrunch.build.14.0.config'. Open the file, and look for a bunch of binding redirections like the following:
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-4.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-4.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-4.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
... Remove these, and replace them with the following:
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-12.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-12.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-12.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Conversion.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-12.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Tasks.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-12.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Utilities.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-12.0.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>
Does this solve the issue?
Hi,
The proposed change worked.
Thanks for fixing it so fast.
Wilhelm
The proposed change worked.
Thanks for fixing it so fast.
Wilhelm
Remco NCrunch Developer
#7565
31 Jul 2015 11:13 UTC
Excellent. Thanks for confirming the fix. I'll see that these changes are introduced into the next version of NCrunch.
Post a reply
Log in to reply.