You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-9
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,19 @@
1
-
# T4 Text Templating with .NET 5
2
-
The software in this repository allows you to run a T4 template with the .NET 5 runtime. This means you can load .NET Core and .NET 5 assemblies and use .NET 5 libraries. My team uses it to generate C# code for types in a .NET Core 3.1 assembly (using Reflection). We also use it to process a JSON file using .NET 5's System.Text.Json library.
1
+
# T4 Text Templating with .NET 6
2
+
The software in this repository allows you to run a T4 template with the .NET 6 runtime. This means you can load .NET Core and .NET 5/6 assemblies and use .NET 6 libraries. My team uses it to generate C# code for types in a .NET Core 3.1 assembly (using Reflection). We also use it to process a JSON file using .NET 6's System.Text.Json library.
3
3
4
4
__Author:__ RdJNL
5
5
6
6
## Latest release
7
-
Version 1.1.1 can be downloaded [here](https://github.com/RdJNL/TextTemplatingCore/releases/download/v1.1.1/TextTemplatingCore_v1.1.1.zip).
7
+
Version 1.2.0 can be downloaded [here](https://github.com/RdJNL/TextTemplatingCore/releases/download/v1.2.0/TextTemplatingCore_v1.2.0.zip).
8
8
9
9
## Requirements
10
-
- .NET 5
10
+
- .NET 6
11
11
- .NET Framework 4.8
12
-
- Visual Studio 2019 (for the VS extension)
12
+
- Visual Studio 2019/2022 (for the VS extension)
13
13
14
14
## How to use it
15
15
16
-
### Visual Studio 2019 extension
16
+
### Visual Studio 2019/2022 extension
17
17
- The extension is provided as a VSIX file. Run this file to install the extension to Visual Studio. You may need to use an elevated command prompt to run the file as admin.
18
18
- Once the extension is installed, open your solution in Visual Studio.
19
19
- Select the `.tt` file in the Solution Explorer, right click it and click properties.
@@ -23,21 +23,23 @@ Version 1.1.1 can be downloaded [here](https://github.com/RdJNL/TextTemplatingCo
23
23
### TextTransformCore executable
24
24
To use the executable, simply run it from the command line. Provide as first and only argument the path to the template file. If the path has spaces in it, makes sure to surround it with double quotes (`"`).
25
25
26
-
## Limitations
26
+
## Differences with Visual Studio's T4 processor
27
27
There are several limitations to this approach:
28
28
- The hostspecific setting __must__ be false.
29
29
- No debugging.
30
30
- No template parameters.
31
31
- The VS extension cannot be used in database projects (this seems to be a bug in Visual Studio).
32
32
33
-
## Extra feature
34
33
This processor has one feature that Visual Studio's processor does not have:
35
34
- From a T4 template, you can access the `TemplateFile` string property to get the absolute path to the template file.
36
35
36
+
There is one other difference with Visual Studio's processor:
37
+
- When running a template using the VS extension, relative paths in assembly directives are relative to the T4 template file, rather than to the solution directory. To provide a path relative to the solution directory, use the `$(SolutionDir)` environment variable.
38
+
37
39
## How does it work?
38
40
The following steps are followed to process the T4 template:
39
41
- .NET Framework 4.8 code (either the VS extension or the TextTransformCore executable) uses Visual Studio's T4 template processor to preprocess the template into C# code. This C# code is saved to a temporary file.
40
-
- The .NET Framework code runs a .NET 5 executable which compiles the C# code and runs it. The result is once again saved to a temporary file.
42
+
- The .NET Framework code runs a .NET 6 executable which compiles the C# code and runs it. The result is once again saved to a temporary file.
41
43
- The .NET Framework code loads the content of the temporary file and either passes it to Visual Studio (the VS extension) or saves it to the output file (the TextTransformCore executable).
0 commit comments