Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added visual studio support for dot net .tt files #807

Merged
merged 2 commits into from
Jun 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/tools/dotnet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions tests/actions/vstudio/cs2005/test_files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down