Hi,
I have the following issue with NCrucnh building projects with T4.
In our project we heavily use T4 code generation. While simple scenarios works perfect with ncrunch, other breaks ncrunch builds.
We have T4 templates that depends on other project output dlls. The template loads these dlls and use some types defined there.
The issue it that our templates are built using custom Target defined in csproj file named "BeforeCompile". The T4 project looks like:
Code:
<Project xmlns="(- BROKEN LINK -)">
<PropertyGroup>
<T4>$(CodeDir)Libs\T4\TextTransform.exe</T4>
</PropertyGroup>
<ItemGroup>
<T4AssemblyFolder Include="$(CodeDir)Main\Project1\bin\$(ConfigurationName)"/> <!-- SIC --->
<T4AssemblyReference Include="Project1.dll"/>
<T4AssemblyReference Include="Project2.dll"/>
</ItemGroup>
<Target Name="T4DslGen">
<Message Text="Generating..." Importance="high"/>
<Exec Command="$(T4) $(T4Input) @(T4IncludeFolder->'-I %(FullPath)',' ') @(T4AssemblyReference->'-r %(FileName)%(Extension)',' ') @(T4AssemblyFolder->'-P %(FullPath)',' ') " />
<Message Text="Generated." Importance="high"/>
</Target>
</Project>
And the T4 target is
Code:
<Target Name="BeforeCompile">
<ItemGroup>
<T4Template Include="Source\LangScriptSource.tt" />
<SelfProject Include="$(ProjectFileName)">
<Properties>T4Input=$(ProjectDir)%(T4Template.identity)</Properties>
</SelfProject>
</ItemGroup>
<MSBuild Projects="@(SelfProject)" BuildInParallel="true" Targets="T4DslGen" />
</Target>
Ncrunch failed with the following:
Source\LangScriptSource.tt (0)#0: Compiling transformation: Metadata file 'Project1.dll' could not be found
Source\LangScriptSource.tt (0)#0: Compiling transformation: Metadata file 'Project2.dll' could not be found..\..\Libs\T4\T4.targets (33)#7: The command "C:\Users\user\AppData\Local\NCrunch\4548\117\Main\Dsl\..\..\Libs\T4\TextTransform.exe C:\Users\user\AppData\Local\NCrunch\4548\117\Main\Dsl\Source\LangScriptSource.tt -r Project1.dll -r Project2.dll -P C:\Users\user\AppData\Local\NCrunch\4548\117\Main\Dsl\bin\Debug -P C:\Users\user\AppData\Local\NCrunch\4548\117\Main\Project1\bin\Debug " exited with code 1.
It seems that Ncrunch do not copy referenced project output even if "Copy references assemblies in workspace" and "Include static references in workspace" are turned on.
It there any workarroud to get correct output from references projects?
Thanks,
Alex