asp.net-core – 运行Add-Migration时无法加载程序集Microsoft.E
发布时间:2020-12-16 07:34:35 所属栏目:asp.Net 来源:网络整理
导读:我用以下.csproj创建了一个类库项目: Project Sdk="Microsoft.NET.Sdk" PropertyGroup TargetFrameworknetcoreapp1.1/TargetFramework /PropertyGroup ItemGroup PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" / Packa
我用以下.csproj创建了一个类库项目:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp1.1</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.sqlserver.Design" Version="1.1.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" /> </ItemGroup> </Project> 运行命令时: Add-Migration -Name Test -Context TestContext 我收到以下错误: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore.Design,Culture=neutral,PublicKeyToken=null'. The system cannot find the file specified. File name: 'Microsoft.EntityFrameworkCore.Design,PublicKeyToken=null' at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks,IntPtr ptrLoadContextBinder) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,RuntimeAssembly reqAssembly,IntPtr ptrLoadContextBinder) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly,String startupAssembly,String projectDir,String contentRootPath,String dataDirectory,String rootNamespace,String environment) at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor() at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsAddCommand.Execute() at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args) at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args) Could not load file or assembly 'Microsoft.EntityFrameworkCore.Design,PublicKeyToken=null'. The system cannot find the file specified. 但是,已经安装了Microsoft.EntityFrameworkCore.Design. 我正在使用Visual Studio Community 2017(VisualStudio / 15.0.0 26228.9) 我错过了什么? 解决方法
它在添加Microsoft.EntityFrameworkCore.Tools.DotNet并将dotnet工具的版本更改为1.0.0-msbuild2-final后工作,现在我的.csproj是:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp1.1</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.sqlserver.Design" Version="1.1.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0-msbuild2-final" /> <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild2-final" /> </ItemGroup> </Project> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 如何使用ViewBag创建一个下拉列表?
- ASP.Net httpruntime executionTimeout不工作(而且debug =
- 为什么我需要在ASP.NET控件上调用处理?
- asp.net-mvc – ASP.NET MVC重复任务
- asp.net – 在数据库中存储日期时间?
- ASP.NET MVC 4 AJAX提交表单不工作
- .net – ASP MVC HTML Helpers – 好还是坏?
- asp.net-mvc – 实体框架TPC继承(请现在拍我)
- 无法从按钮onclick事件ASP.NET 4调用Javascript函数
- asp.net – 使用HttpModules将事件附加到Session OnStart和
推荐文章
站长推荐
热点阅读