Merge pull request #807 from Blizzard/tt-support

Added visual studio support for dot net .tt files
This commit is contained in:
Tom van Dijck 2017-06-18 15:11:04 -07:00 committed by GitHub
commit be91850928
2 changed files with 32 additions and 1 deletions

View File

@ -45,7 +45,7 @@
info.action = "Compile"
elseif fcfg.buildaction == "Embed" or ext == ".resx" then
info.action = "EmbeddedResource"
elseif fcfg.buildaction == "Copy" or ext == ".asax" or ext == ".aspx" or ext == ".dll" then
elseif fcfg.buildaction == "Copy" or ext == ".asax" or ext == ".aspx" or ext == ".dll" or ext == ".tt" then
info.action = "Content"
elseif fcfg.buildaction == "Resource" then
info.action = "Resource"
@ -117,6 +117,13 @@
info.SubType = "Form"
end
testname = basename .. ".tt"
if project.hasfile(fcfg.project, testname) then
info.AutoGen = "True"
info.DesignTime = "True"
info.DependentUpon = testname
end
end
-- Allow C# object type build actions to override the default
@ -168,6 +175,15 @@
end
end
if info.action == "Content" and fname:endswith(".tt") then
local testname = fname:sub(1, -4) .. ".cs"
if project.hasfile(fcfg.project, testname) then
info.Generator = "TextTemplatingFileGenerator"
info.LastGenOutput = path.getname(testname)
info.CopyToOutputDirectory = nil
end
end
if info.action == "None" and fname:endswith(".xsd") then
local testname = fname:sub(1, -5) .. ".Designer.cs"
if project.hasfile(fcfg.project, testname) then

View File

@ -127,6 +127,21 @@
]]
end
function suite.textTemplatingDependency()
files { "foobar.tt", "foobar.cs" }
prepare()
test.capture [[
<Compile Include="foobar.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>foobar.tt</DependentUpon>
</Compile>
<Content Include="foobar.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>foobar.cs</LastGenOutput>
</Content>
]]
end
--
-- File associations should always be made relative to the file