Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

T4 cannot find netstandard 2.1 #1669

Closed
Emdot opened this issue Dec 21, 2019 · 20 comments
Closed

T4 cannot find netstandard 2.1 #1669

Emdot opened this issue Dec 21, 2019 · 20 comments
Labels

Comments

@Emdot
Copy link

Emdot commented Dec 21, 2019

When a T4 compile-time template references a netstandard 2.1 assembly, if the template's code tries to instantiate a class from that assembly it generates an error:

Running transformation: System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
File name: 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at Microsoft.VisualStudio.TextTemplatingDF0B46F7DFCCCF2CAD1FBB2E3A8D5FC6225E74132FDDBD12D44030F822D8B29A6DFFE0B2FED81F4BED62AEA63823EBB5C1182E33103987C1DA7368F9D1022F09.GeneratedTextTransformation.TransformText()
   at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
   at Microsoft.VisualStudio.TextTemplating.TransformationRunner.PerformTransformation()

This occurs even if the project containing the T4 template targets netstandard 2.1.

Test case attached: just right-click TT.tt and select Run Custom Tool. The error message appears.

NetStandardT4.zip

Microsoft Visual Studio Community 2019, v 16.4.0; 64-bit PC; 64-bit Windows 10. I'm using the Devart Template Editor extension, v 1.0.11.0. I do not see this error when the dependency targets netstandard 2,0 instead.

@rdorta
Copy link

rdorta commented Jan 1, 2020

+1

@peter-perot
Copy link

Any news here? I lifted a project to netstandard 2.1, but now I'm not able to run the t4 text template generator.

@WizX20
Copy link

WizX20 commented Feb 6, 2020

I'm also having this issue with T4 templates.

@sgaliamov
Copy link

+1

@androdd
Copy link

androdd commented May 27, 2020

+1
Adding this <#@ assembly name="netstandard" #> shows me this error:
Running transformation: System.BadImageFormatException: Cannot load a reference assembly for execution.

@drewdelano
Copy link

+1

1 similar comment
@stason4ik
Copy link

+1

@kccarter76
Copy link

kccarter76 commented Jul 27, 2020

the templating engine is not resolving, netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51

the assembly for version 2.1 is not in the gac., currently .net core 3.x is the only runtime that can use the netstandard 2.1. the assembly can be found in the runtime folders for netcoreapp 3.x.

@duda92
Copy link

duda92 commented Aug 6, 2020

+1

2 similar comments
@appie2go
Copy link

+1

@amather
Copy link

amather commented Sep 1, 2020

+1

@pellea
Copy link

pellea commented Oct 16, 2020

Any news on that one? Still have the same issue ...

@AKA285066112
Copy link

+1

1 similar comment
@Nokecy
Copy link

Nokecy commented Jan 7, 2021

+1

@ihatred123x
Copy link

same issue. any news? happy new year.

@jlaw74
Copy link

jlaw74 commented Jan 14, 2021

Same issue. Any updates. I have two machines running VS 16.8.4. I get this error when attempting to Add-Migration on one of them.

@DenisKudelin
Copy link

+1

1 similar comment
@ali50m
Copy link

ali50m commented Oct 23, 2021

+1

@Afischbacher
Copy link

Any update here please from the team, it been over 2 years and there is still no fix for this issue and it's forcing people like myself to not be able to use .NET Standard 2.1 due to my dependency and usage of T4 templates.

@terrajobst terrajobst added the bug label Aug 18, 2022
@terrajobst
Copy link
Member

My understanding of T4 is that it runs on .NET Framework. As such, it won't work with .NET Standard 2.1 but should work for .NET Standard 2.0, assuming you run on .NET Framework 4.7.2 or higher, see footnote 2.

@terrajobst terrajobst closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests