我在当前项目上运行迁移时遇到问题。
这一切都是在我尝试使用Visual Studio 2015上的Package Manager控制台添加迁移时开始的。对模型所做的更改将不会应用,并且迁移Up / Down方法为空。
我尝试删除迁移,创建新迁移,删除数据库并从头开始。没有任何效果。
毕竟我使用
在项目中运行完整的Clean主菜单>构建>批量构建>清洁
每次尝试在Package Manage Console上运行EF命令时都会这样:
PM>更新数据库
我收到此错误:
无法找到程序集' D:\ Repo \ Tapr \ src \ Tapr.Api。\ bin \ Debug \ net461 \ win7-x64 \ Tapr.Api.exe'。
我现在没有用project.json
定位win7-64运行时。
我试过这样做,文件夹\bin\Debug\net461\win7-x64
没有被创建。
有关如何在正确的 win10-x64 文件夹中进行EF搜索项目的任何想法?
非常感谢!
更新
global.json
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003156"
}
}
project.json
{
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"compile": {
}
},
"dependencies": {
"IdentityServer4": "1.0.0",
"IdentityServer4.AspNetIdentity": "1.0.0",
"IdentityServer4.EntityFramework": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
"Microsoft.AspNetCore.Authentication.Facebook": "1.1.*",
"Microsoft.AspNetCore.Authentication.Google": "1.1.*",
"Microsoft.AspNetCore.Authentication.LinkedIn": "1.0.1",
"Microsoft.AspNetCore.Authentication.MicrosoftAccount": "1.1.0",
"Microsoft.AspNetCore.Authentication.Twitter": "1.1.*",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.*",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.*",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.*",
"Microsoft.AspNetCore.StaticFiles": "1.1.*",
"Microsoft.EntityFrameworkCore": "1.1.0",
"Microsoft.EntityFrameworkCore.Design": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.*",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.*",
"Microsoft.Extensions.Logging.Debug": "1.1.*",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
"System.Linq": "4.0.0",
"System.Reflection.TypeExtensions": "4.3.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
"Microsoft.EntityFrameworkCore.Tools": "1.2.0-preview1-23339",
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.2.0-preview1-23339"
},
"frameworks": {
"net461": {
"dependencies": {
"Tapr.Utils.Messenger.Email": "1.0.0-*",
"Tapr.Utils.Messenger.Sms": "1.0.0-*"
}
}
},
"runtimeOptions": {
"gcServer": true
},
"runtimes": {
"win10-x64": {}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config",
"idsrv3test.pfx"
]
},
"scripts": {
"postpublish": [
"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
]
},
"configurations": {
"Debug": {
"buildOptions": {
"define": [ "DEBUG", "TRACE" ],
"emitEntryPoint": true,
"preserveCompilationContext": true
}
},
"Staging": {
"buildOptions": {
"define": [ "STAGING", "TRACE" ],
"emitEntryPoint": true,
"preserveCompilationContext": true
}
},
"Release": {
"buildOptions": {
"define": [ "RELEASE", "TRACE" ],
"emitEntryPoint": true,
"preserveCompilationContext": true,
"optimize": true,
"platform": "x64"
}
}
}
}
PM> dotnet --version导致:
1.0.0-preview2-003156
答案 0 :(得分:0)
完全从runtimes
删除project.json
部分。您使用工具的预览版本 - 可能存在错误或“未完成”功能。
如果确实需要,您可以在创建迁移后返回runtimes
。但重新评估,你真的需要吗?让runtimes
创建自包含部署(more info),您不需要在生产服务器上安装.NET Core,但您必须在dev / build机器上具有确切的运行时才能将所有必需的文件放入你发布/发布文件夹。