Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

T4 TransformOnBuild, how to ensure dependent assemblies are copied into $(TargetDir)

$
0
0

I am trying to create a NuGet package that deploys some T4 .ttinclude files which in turn rely on a number of referenced assemblies. But I'm having issues in consuming projects when I try to enable

The .ttinclude files have been designed to reference required assemblies using the following syntax:

<#@ assembly name="$(TargetDir)WidgetDatabase.dll" #>

In my NuGet package's target file, I configure T4ParameterValues so that the $(TargetDir) is passed to the T4 text transformer:

<ItemGroup><T4ParameterValues Include="TargetDir"><Value>$(TargetDir)</Value><Visible>false</Visible></T4ParameterValues></ItemGroup>

In the target .csproj, I have the following:

<PropertyGroup><TransformOnBuild>true</TransformOnBuild></PropertyGroup><ItemGroup><PackageReference Include="WidgetDatabase"><Version>0.8.1-alpha</Version></PackageReference></ItemGroup><Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /><Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v16.0\TextTemplating\Microsoft.TextTemplating.targets" />

The problem is that the T4 Text Transform occurs before the build, but this means that none of the referenced assemblies are copied into $(TargetDir). How can I force the dependencies to be copied into the $(TargetDir) prior to the text transform target running?

This question is related, but doesn't satisfactorily resolve this issue.


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>