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

dotnet-t4: Default .txt extension doesn't match VS #128

Open
bricelam opened this issue May 3, 2022 · 3 comments
Open

dotnet-t4: Default .txt extension doesn't match VS #128

bricelam opened this issue May 3, 2022 · 3 comments

Comments

@bricelam
Copy link

bricelam commented May 3, 2022

Visual Studio peaks at the template directive's language argument to determine the default output extension. It uses .cs for C# and .vb for VB. If the language argument isn't specified, it assumes C#.

mono-t4, however appears to use .txt as the default extension. This requires me to specify the -o command-line option duplicating the input path and filename.

t4 -o ./src/MyApp/MyTemplate.cs ./src/MyApp/MyTemplate.tt

Would you consider changing the default to align better with the Visual Studio tooling? Or would this be too much of a breaking change?

@devlead
Copy link
Contributor

devlead commented May 3, 2022

You can control the extension by using the T4 Output Directive i.e.

<#@ output extension=".cs" #>
public class MyClass
{
}

@bricelam
Copy link
Author

bricelam commented May 4, 2022

Yes, that is an alternative workaround to this issue.

@mhutch
Copy link
Member

mhutch commented Oct 4, 2022

Changing it for preprocessed templates per #130 definitely makes sense.

However, I'd like to create a perception that T4 is for generating any kind of text, not just C#/VB.NET code, and keeping it as .txt would help with that I think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants