dotnet / dotnet/project-system
TextTemplating fails to transform templates when referencing solution or nuget assemblies
- Dominant language
- C#
- Stars
- 1k
- Forks
- 415
- PR merge metrics
- No merged PRs in 30d
Description
The TextTemplatingFileGenerator custom msbuild target doesn't work from the IDE even though calling msbuild /t:TransformAll works from the command line when T4AssemblyReference and/or T4ReferencePath from a csproj.
We've modified a new style csproj to use the msbuild task/targets for T4 transformation and we can build successfully from the command line. When right clicking on the project and selecting `Run Custom Tool` it will error with 'The type or namespace 'xxxx' could not be found'.
This is likely due to the IDE not passing T4ReferencePath and T4AssemblyReference to the executable/host the IDE uses for T4 transformation (in the Common7\IDE directory).
Example Bug.csproj:
``` XML
netstandard2.0
15.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
false
false
TextTemplatingFileGenerator
TextTemplatingFileGenerator
Bug.cs
True
True
Bug.tt
```
Example Bug.tt:
```
<#@ template debug="true" hostspecific="true" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="Humanizer"#>
```
_This issue has been moved from https://developercommunity.visualstudio.com/content/problem/244626/texttemplating-fails-to-transform-templates-when-r.html
VSTS ticketId: 610366_
Contributor guide
Assessment
This issue has not been assessed yet.