I am trying to get my T4 template to refer to my assembly in my solution so that when changing configurations between debugging and release it would include the correct assembly from my solution.
Here is what I tried:
<#
var serviceProvider = Host as IServiceProvider;
var dte = serviceProvider.GetService(typeof(DTE)) as DTE;
string ConfigName = dte.Solution.SolutionBuild.ActiveConfiguration.Name;
if (configName == "Debug") {
#>
<#@ include file="template.Debug.tt" #>
<# } else { #>
<#@ include file="template.Release.tt" #>
<# } #>
The template.Debug.tt file looks like this:
<
name="$(SolutionDir)TestProject.Core/bin/Debug/TestProject.Core.dll"
And the template.Release.tt file looks like this:
<
name="$(SolutionDir)TestProject.Core/bin/Release/TestProject.Core.dll"
I get this error when I try to start the main T4:
Error 1 Compilation of conversion: assembly with the same simple name "TestProject.Core", Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null has already been imported. Try to remove one of the links or sign them to include side by side.
, , , , .
:
<
name="$(SolutionDir)TestProject.Core/bin/$(Configuration)/TestProject.Core.dll"
$()?
, Debug .
DLL , , .