Can't run T4 template

Hello Everyone.

I'm using Rider on Linux to develop a Unity project. I gave a try to the T4 feature and, at the beginning, it worked very well. I created a .tt file and whenever I modified it the corresponding .cs file was generated.

Now I can't run the template anymore and I have no idea why. If I modify the .tt file nothing happen to the .cs file. When I right click the .tt file the Run Template command in the context menu is grayed. Rider doesn't report any error anywhere.

So, is there a way to, at least, get an error message or something so I can understand why Rider doesn't feels like running that template?

Thanks.

0
4 comments

Hi MadWatch

Could you please first let me know, what Rider version do you use?

Also, I'd like to ask you to collect logs so we could check them for errors. One can do it via `Help | Report a bug` after reproducing the issue. In this case, logs could be collected and attached automatically to a new YouTrack bug report. 
Thank you in advance! 

0

Hello Alexandra

I created a bug report. Here is the link.

I don't have much to say in the report because, again, there is no error message anywhere. I looked into the logs but couldn't find anything relevant. Template generation just stopped working for no apparent reason. This is a huge problem for me. Without template generation I can not compile my project, meaning I have to stop using Rider until a solution is found.

Thanks.

 

 

0

I also encountered this issue. After running, the output error was: 

Could not load file or assembly 'JetBrains.EnvDTE.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

The same result occurs across multiple environments. Below is the environment information: 

  • JetBrains Rider 2024.1.2 -\> #RD-241.15989.179 
  • JetBrains Rider 2022.2.4 -\> #RD-222.4459.9 

Test code configuration: 

<#@ template language="C#" hostspecific="True" #>
<#@ assembly name="EnvDTE" #>
<#@ import namespace="EnvDTE" #>
<# 
	try { 
		var provider = (IServiceProvider)Host; 
		if (provider == null) throw new ArgumentNullException(nameof(Host), "Could not obtain host ServiceProvider"); 
		var service = provider.GetService(typeof(DTE));
		var dte = (DTE)service ?? throw new ArgumentNullException(nameof(Host), "Could not obtain DTE from host"); } 
	catch (Exception e) { 
		throw new InvalidOperationException("Could not obtain DTE from host", e);
	} 
#> 

error output

Unhandled Exception: System.InvalidOperationException: Could not obtain DTE from host ---> System.IO.FileLoadException: Could not load file or assembly 'JetBrains.EnvDTE.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) at Microsoft.VisualStudio.TextTemplating.JetBrains.TextTemplatingEngineHost.GetService(Type serviceType) at JetBrains.Rider.TextTemplating.GeneratedTextTransformation.TransformText() --- End of inner exception stack trace --- at JetBrains.Rider.TextTemplating.GeneratedTextTransformation.TransformText() at JetBrains.Rider.TextTemplating.ReSharperGeneratedTransformationExecutor.<>c__DisplayClass1_0.<PostRegisterMain>b__0(Lifetime lifetime) at JetBrains.Lifetimes.Lifetime.UsingNested[T](Func`2 action) at JetBrains.Rider.TextTemplating.ReSharperGeneratedTransformationExecutor.PostRegisterMain(String[] args) at JetBrains.Rider.TextTemplating.ReSharperGeneratedTransformationExecutor.Main(String[] args) 
0

Hi Xinansky99

This is a known problem for the latest Rider version. Please follow the issue to stay updated. 

 

0

Please sign in to leave a comment.