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
The T4.BuildTools package seems to compile t4 files against a different version of .net depending on if the build is run from visual studio vs dotnet build.
The T4 MSBuild tasks run on the same version of .NET that MSBuild runs on. MSBuild in Visual Studio runs on .NET 4.8 , which reports its version as "4.0.x" (iirc for compatibility reasons).
It would be pretty easy to support newer C# versions when running on. NET 4.8 by adding some logic to locate and use the newer version of csc that's bundled with Visual Studio or dotnet. Currently when running on .NET 4.8 the T4 engine uses the version of csc from the .NET Framework directory, which is very old.
Running the templates on .NET 8 when running the build tasks on .NET 4.8 is doable but would necessitate some kind of out-of-process hosting model for template execution. This would definitely be useful and has been on the backlog for a while.
In the meantime an option to disable VS building on safe might be useful. Otherwise you need to either ignore the errors in VS or stick with the older language features
The T4.BuildTools package seems to compile t4 files against a different version of .net depending on if the build is run from visual studio vs dotnet build.
My Project file looks like:
Program.tt looks like:
When built and run from visual studio it outputs "4.0.30319.42000"
When built and run via dotnet run it outputs "8.0.5"
newer C# features like interpolation also dont work when run within visual studio.
The text was updated successfully, but these errors were encountered: