Created
June 7, 2016 00:28
-
-
Save JeremyKuhne/a35615d008259bef144139c8e0628fb4 to your computer and use it in GitHub Desktop.
Custom targets to allow VS T4 templates to pick up build properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- Include this target at the end of your project file to allow properties to be fully initialized --> | |
<!-- Set up common properties for T4 text templating --> | |
<ItemGroup> | |
<!-- Release, debug, etc. --> | |
<T4ParameterValues Include="Configuration"> | |
<Value>$(Configuration)</Value> | |
</T4ParameterValues> | |
<!-- The platform, such as AnyCPU --> | |
<T4ParameterValues Include="Platform"> | |
<Value>$(Platform)</Value> | |
</T4ParameterValues> | |
<!-- The assembly name, without .dll --> | |
<T4ParameterValues Include="AssemblyName"> | |
<Value>$(AssemblyName)</Value> | |
</T4ParameterValues> | |
<!-- The directory for the output file --> | |
<T4ParameterValues Include="TargetDir"> | |
<Value>$(TargetDir)</Value> | |
</T4ParameterValues> | |
<!-- Full path to the output file --> | |
<T4ParameterValues Include="TargetPath"> | |
<Value>$(TargetPath)</Value> | |
</T4ParameterValues> | |
<!-- Example: .NETPortable --> | |
<T4ParameterValues Include="TargetFrameworkIdentifier"> | |
<Value>$(TargetFrameworkIdentifier)</Value> | |
</T4ParameterValues> | |
<!-- Example: v5.0 --> | |
<T4ParameterValues Include="TargetFrameworkVersion"> | |
<Value>$(TargetFrameworkVersion)</Value> | |
</T4ParameterValues> | |
<!-- Example: Portable --> | |
<T4ParameterValues Include="TargetPlatformIdentifier"> | |
<Value>$(TargetPlatformIdentifier)</Value> | |
</T4ParameterValues> | |
<!-- Example: 7.0 --> | |
<T4ParameterValues Include="TargetPlatformVersion"> | |
<Value>$(TargetPlatformVersion)</Value> | |
</T4ParameterValues> | |
</ItemGroup> | |
<!-- Make sure items that are directly hitting the MSBuild target are included for processing --> | |
<Target | |
Name="CreateT4ItemListsForMSBuildCustomTool" | |
BeforeTargets="CreateT4ItemLists" | |
AfterTargets="SelectItemsForTransform"> | |
<ItemGroup> | |
<T4Transform Include="@(CreateT4ItemListsInputs)" Condition="'%(CreateT4ItemListsInputs.Generator)' == 'MSBuild:TransformAll'" /> | |
</ItemGroup> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment