I'm trying to automate build process for CI server of Silverlight 5 application using OpenRIA Services.
I've got database-first Entity Framework .edmx generated file from which DomainModel is generated, and as part of build I want to generate entities by T4 code generator.
My server .csproj
changes.
Imports
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
# Microsoft.TextTemplating.targets are added after CSharp.targets
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v12.0\TextTemplating\Microsoft.TextTemplating.targets"/>
and properties
<PropertyGroup>
<TransformOnBuild>true</TransformOnBuild>
...
<PropertyGroup>
Installed sdk, and tools:
Looks correct, but at build there is such a error
5> Transforming template DomainModel\EntityConverters.tt...
5>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TextTemplating\Microsoft.TextTemplating.targets(396,5): error : Failed to resolve include text for file:C:\{path to my project}\DomainModel\EF.Utility.CS.ttinclude. Line=-1, Column=-1
5>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TextTemplating\Microsoft.TextTemplating.targets(396,5): error : Loading the include file 'EF.Utility.CS.ttinclude' returned a null or empty string. The transformation will not be run. . Line=21, Column=4
All .tt
files has T4 import
<#@ include file="EF.Utility.CS.ttinclude"#>
I have a suspicion that it's targeting local directory, not even build directory.
I'm curious why Microsoft.TextTemplating.targets
variable is targeting EF.Utility.CS.ttinclude
in {path to my project}
not in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes
where it really is.
Loading the include file 'EF.Utility.CS.ttinclude' returned a null or empty string
seems legit according to this path.
Maybe I've missed some setting, import or path set? How I can change or update path for this utility?
Associated Q&A already checked:
Problem can be solved by adding absolute or relative path to EF.Utility.CS.ttinclude
in your T4 file. For build server the best solution is probably to copy files that usualy can be found in path C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes
to your project and then change the line:
<#@ include file="EF.Utility.CS.ttinclude"#>
to for example:
<#@ include file="..\..\EF.Utility.CS.ttinclude"#>
For some reason when template transformation is run from MSBuild it looks for .ttinclude
files in the same location that .tt
file is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With