Closed ErikEJ closed 5 years ago
This code is more appropriate if you have access to EnvDTE: https://github.com/aspnet/EntityFrameworkCore/blob/dev/src/EFCore.Tools/tools/EntityFrameworkCore.psm1#L757-L872
I do not, but thanks
@bricelam I actually do have access to EnvDTE, thanks for the hint!
@bricelam Does this mean I MUST intall EFCore.Design 2.2.4 in order to make this work? (It works if I do)
dotnet exec --depsfile "C:\Users\Erik\Downloads\ConsoleApp3\ConsoleApp3\bin\Debug\netcoreapp2.2\ConsoleApp3.deps.json" --additionalprobingpath "C:\Users\Erik\.nuget\packages" --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --runtimeconfig "C:\Users\Erik\Downloads\ConsoleApp3\ConsoleApp3\bin\Debug\netcoreapp2.2\ConsoleApp3.runtimeconfig.json" "C:\Users\Erik\AppData\Local\Temp\efpt\efpt.dll" "C:\Users\Erik\Downloads\ConsoleApp3\ConsoleApp3\bin\Debug\netcoreapp2.2\ConsoleApp3.dll"
Error:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore.Design, Version=2.2.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.EntityFrameworkCore.Design, Version=2.2.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
at ReverseEngineer20.EfCoreModelBuilder.BuildResult(String outputPath, Boolean generateDdl)
at ReverseEngineer20.Program.Main(String[] args) in C:\Code\EFCorePowerTools\src\GUI\efpt\Program.cs:line 44
All dependencies of efpt.dll must be installed in the app. I think you can relax assembly version requirements by hooking AppDomain.CurrentDomain.AssemblyResolve
:
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
{
var fullName = new AssemblyName(args.Name);
// Ignore Version, Culture, and PublicKeyToken
return Assembly.Load(fullName.Name);
}
Thanks, just now I refer to version 2.1.0 and 2.2.0 of EfCore.Design, and it seems to work fine.
Does AppDomain exist in .NET Core??
Parts of it were added to 2.0. You can't create new ones though, so there is only ever one app domain per process.
As an alternative they've added custom load contexts and enabled unloading assemblies.
C:\Code\EntityFramework\src\dotnet-ef\RootCommand.cs