At GitHub we'd like to use NCrunch on our GitHub for Visual Studio extension. However, we use T4 templates in some of our projects, which is causing a problem.
You can see the problem at https://github.com/github/VisualStudio/ on the grokys/ncrunch branch. I'm getting the following error:
..\..\lib\Microsoft.TextTemplating.targets (396, 5): An Exception was thrown while running the transformation code. The process cannot continue. The following Exception was thrown:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at Microsoft.VisualStudio.TextTemplating.CompilerBridge..ctor(String source, Boolean debug, IEnumerable`1 references, String cmdLineArguments)
I've added the Microsoft.CodeAnalysis.dll file to the lib directory, and included the lib directory as additional files in NCrunch, but no joy. Any ideas?
This particular build targets takes a range of properties as input, including what appears to be lists of assembly references. I don't think it was designed with NCrunch's workspacing in mind; possibly it assumes that referenced assemblies are co-located with the project being built.
I'd recommend trying NCrunch in compatibility mode to see if there is a setting that works around the problem.
It may be necessary to disable this build target to allow NCrunch to work for your projects. You can do this by adding conditional logic to your build to prevent certain parts of it from being executed by NCrunch. This could be done with a condition on the target itself, or alternatively on the <Import> statement used to include the .targets file inside the build.
Thanks Remco, disabling the target using a conditional solved this for me. I stumbled upon another problem, but I'll start a new thread for that as it's unrelated.