I've run into similar problem with VSTO project as described here http://forum.ncrunch.net/yaf_postst1401_Project-build-failure.aspx
Working with VS2013, latest version of NCrunch.
There are two projects in my solution:
1) VSTO 4.0 Outlook plugin
2) NUnit test project, referencing the first one
When NCrunch is enabled with default settings, I get the following error for plugin project:
..\..\..\..\..\..\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets (176, 9): The "FindRibbons" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'Gsync, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'Gsync, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
The test project seems to build fine, but gives various ambiguity warnings like:
WARNING - Data\OutlookContactRepositoryTests.cs (83, 31): Ambiguity between method 'Microsoft.Office.Interop.Outlook._ContactItem.Close(Microsoft.Office.Interop.Outlook.OlInspectorClose)' and non-method 'Microsoft.Office.Interop.Outlook.ItemEvents_10_Event.Close'. Using method group.
Afterwards I've set "copy referenced assemblies to the workspace" to true for the plugin project. The problem with not finding the file seems to be gone and the tests run. However the code covered by the tests in the main project is not marked by green/red dots - they are all black as if the lines were not covered at all. Any ideas how to resolve this?
I have no personal experience with VSTO projects, but it appears to me that this project type involves the execution of a build step that requires referenced assemblies to exist in the same directory as the assembly being built. Although undesirable, this isn't an unusual situation. Turning on the 'Copy referenced assemblies to workspace' should be the correct way to solve your build problem.
The missing test coverage is more of a mystery. Is the VSTO project, by chance, installed in your GAC? I'm wondering if it may be that NCrunch isn't able to resolve its instrumented version of this project's built assembly during test execution. A way you can confirm this is by running your tests using NCrunch with the debugger enabled, and examining the list of loaded modules in the debug session. The VSTO project should be loaded from inside one of the NCrunch workspaces.
I also suggest checking to see if the engine is giving you any warnings about abnormal assembly resolution behaviour. NCrunch will often detect when the test environment is not as it should be, and it will warn you about this.
Thanks for the response. I've checked the debug output and the main project output "gsync.dll" is loaded correctly. Debug dump below:
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestHost45.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestHost45.x86.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.TestHost45.x86.exe'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestHost45.x86.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.TaskRunner.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestHost45.x86.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.Common.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestHost45.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestHost45.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.TaskRunner.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.Common.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.TestExecution.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.Reflection.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\Gsync.Tests\bin\Debug\Gsync.Tests.dll'. Symbols loaded.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\Modules\NUnit\nCrunch.Module.NUnit.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\Modules\NUnit\nunit.core.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\Modules\NUnit\nunit.core.interfaces.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\_ncrunchreferences\nunit.framework.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\assembly\GAC_MSIL\nCrunch.TestRuntime\2.23.0.2__01d101bf6f3e0aea\nCrunch.TestRuntime.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\_ncrunchreferences\Gsync.dll'. Symbols loaded.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\_ncrunchreferences\NSubstitute.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\_ncrunchreferences\NodaTime.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Outlook\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Outlook.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\_ncrunchreferences\log4net.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'DynamicProxyGenAssembly2'.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'DynamicProxyGenAssembly2'.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\assembly\GAC_MSIL\office\15.0.0.0__71e9bce111e9429c\office.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.