I got simple CRUD app using Entity Framework 6 created in Visual Studio 2017 Enterprise . Schema / models / DB stuff were created using *.edmx
After cloning reposiroty to different computer (or removing all of auto-generated *.cs
files) while trying to build / rebuild I got following errors for every *.tt
file:
Failed to resolve include text for file:[PATH TO APP DIRECTORY HERE]\\EF6.Utility.CS.ttinclude.
Loading the include file 'EF6.Utility.CS.ttinclude' returned a null or empty string. The transformation will not be run.
Manual re-generation of files works fine (via opening popup menu on *.tt
files and clicking Run Custom Tool
)
This file exists in
C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\Extensions\\Microsoft\\Entity Framework Tools\\Templates\\Includes\\EF6.Utility.CS.ttinclude
but I have absolutely no idea why VS is looking for it inside project path.
Is it a bug / problem with VS / EF6 configuration?
I've tried:
None of these helped :(
Similar thread:
Hardcoding correct path in auto-generated *.tt
files IMO is not a proper solution
After follow Microsoft guide , I've added 'IncludeFolders' tag to resolve 'EF6.Utility.CS.ttinclude' and the 'ItemGroup' to invalidate DevEnvDir in template processing. This's how the .csproj file looks like:
...
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<TransformOnBuild>True</TransformOnBuild>
<TransformOutOfDateOnly>false</TransformOutOfDateOnly>
<IncludeFolders>$(DevEnvDir)Extensions\Microsoft\Entity Framework Tools\Templates\Includes</IncludeFolders>
</PropertyGroup>
<ItemGroup>
<T4ParameterValues Include="DevEnvDir">
<Value>$(DevEnvDir)</Value>
<Visible>False</Visible>
</T4ParameterValues>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\TextTemplating\Microsoft.TextTemplating.targets" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.