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

.Net8 scaffold T4 Template problem #5437

Closed
testirme opened this issue Nov 22, 2023 · 1 comment
Closed

.Net8 scaffold T4 Template problem #5437

testirme opened this issue Nov 22, 2023 · 1 comment

Comments

@testirme
Copy link

testirme commented Nov 22, 2023

When I updated all versions to 8, T4 started giving the following error.

error : The type 'Microsoft.EntityFrameworkCore.Metadata.IModel' of the parameter 'Model' did not match the type passed to the template

error : The host parameter 'Model' could not be converted to the type 'System.CodeDom.CodeTypeReference' specified in the template

error : Error running transform: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.BadImageFormatException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Reference assemblies cannot be loaded for execution. (0x80131058)
File name: 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' ---> System.BadImageFormatException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL'. Reference assemblies cannot be loaded for execution. (0x80131058)
File name: 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL' ---> System.BadImageFormatException: Cannot load a reference assembly for execution.
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at Mono.TextTemplating.TemplateAssemblyLoadContext.Load(AssemblyName assemblyName) in /_/Mono.TextTemplating/Mono.TextTemplating/TemplateAssemblyLoadContext.cs:line 64
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at Microsoft.VisualStudio.TextTemplating3837c1b.GeneratedTextTransformation.TransformText()
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Mono.TextTemplating.CompiledTemplate.TemplateProcessor.CreateAndProcess(ITextTemplatingEngineHost host, CompiledAssemblyData templateAssemblyData, String templateAssemblyFile, String fullName, CultureInfo culture, String[] referencedAssemblyFiles) in /_/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.TemplateExecutor.cs:line 78

Processing 'D:\AKINSOFT\cloud\erpcloud\Libraries\Asnet.Cloud.Data\CodeTemplates\EFCore\DbContext.t4' failed.
@roji
Copy link
Member

roji commented Nov 22, 2023

Duplicate of dotnet/efcore#32385

@roji roji marked this as a duplicate of dotnet/efcore#32385 Nov 22, 2023
@roji roji closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2023
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

2 participants