efcore: Scaffolding doesn't work with the latest version of Mono.TextTemplating
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.
About this issue
- Original URL
- State: open
- Created 7 months ago
- Comments: 19 (7 by maintainers)
Commits related to this issue
- Revert behavior to throw when attempting to modify an unconstrained alternate key property Fixes #28961 Reverts #30213 for #32385 In #32385, an unconstrained alternate key was added to the model pur... — committed to dotnet/efcore by ajcvickers 7 months ago
- Proof of concept for #32385 — committed to dotnet/efcore by ajcvickers 7 months ago
- Revert behavior to throw when attempting to modify an unconstrained alternate key property (#32492) Fixes #28961 Reverts #30213 for #32385 In #32385, an unconstrained alternate key was added to t... — committed to dotnet/efcore by ajcvickers 7 months ago
- Revert behavior to throw when attempting to modify an unconstrained alternate key property (#32492) Fixes #28961 Reverts #30213 for #32385 In #32385, an unconstrained alternate key was added to t... — committed to dotnet/efcore by ajcvickers 7 months ago
The cause of the error is “Microsoft.VisualStudio.Web.CodeGeneration.Design”