.NET Core 1.0和EntityFramework 7不兼容(.NET Core 1.0 and EntityFramework 7 Not Compatible)
我已经升级到Visual Studio Code 1.0.0,并且正在尝试在新版本之前改进之前在VSCode中处理的ASP.NET Core项目。 就配置而言,VSCode看起来非常不同。 我已经使用了本教程和这些示例 。 我有合理的成功让我的项目的MVC6方面编译和工作正常,但EntityFramework 7方面是一个不行。
当我在我的项目上进行
dotnet restore
时,出现以下错误:Package EntityFramework.Core 7.0.0-rc1-final is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0).
我一直在或多或少随机地尝试project.json来寻找解决方案,但我似乎没有取得太大进展。 netcoreapp1.0仍然太新以至于无法与EntityFramework兼容吗? 有什么选择可用?
顺便说一句,这是我的project.json。 从上面提到的HelloMvcApi示例中可以看到很多股票,但是增加了EntityFramework.Core依赖项:
{ "compilationOptions": { "emitEntryPoint": true, "debugType": "portable" }, "dependencies": { "Microsoft.AspNetCore.Mvc.Core": "1.0.0-*", "Microsoft.AspNetCore.Mvc.Formatters.Json": "1.0.0-*", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-*", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", "Microsoft.Extensions.Logging.Console": "1.0.0-*", "EntityFramework.Core": "7.0.0-rc1-final", "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0-*" } }, "frameworks": { "netcoreapp1.0": { "imports": [ "portable-net45+wp80+win8+wpa81+dnxcore50" ] } }, "tools": { "Microsoft.AspNetCore.Server.IISIntegration.Tools": { "version": "1.0.0-*", "imports": "portable-net45+wp80+win8+wpa81+dnxcore50" } }, "scripts": { "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" } }
I've upgraded to Visual Studio Code 1.0.0 and I'm trying to retrofit an ASP.NET Core project I was working on in VSCode previously, before the new release. VSCode is seemingly quite different now in terms of configuration. I've worked with this tutorial and these samples. I'm having reasonable success getting the MVC6 aspect of my project compiling and working properly, but the EntityFramework 7 aspect is a no-go.
When I do a
dotnet restore
on my project, I get the following error:Package EntityFramework.Core 7.0.0-rc1-final is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0).
I've been experimenting more-or-less randomly with the project.json in the hopes of finding a solution, but I don't seem to be making much progress. Is netcoreapp1.0 still just too new to be retro-compatible with EntityFramework? What options are available?
Here's my project.json, by the way. It's pretty much stock from the HelloMvcApi sample mentioned above, but with the addition of the EntityFramework.Core dependency:
{ "compilationOptions": { "emitEntryPoint": true, "debugType": "portable" }, "dependencies": { "Microsoft.AspNetCore.Mvc.Core": "1.0.0-*", "Microsoft.AspNetCore.Mvc.Formatters.Json": "1.0.0-*", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-*", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*", "Microsoft.Extensions.Logging.Console": "1.0.0-*", "EntityFramework.Core": "7.0.0-rc1-final", "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0-*" } }, "frameworks": { "netcoreapp1.0": { "imports": [ "portable-net45+wp80+win8+wpa81+dnxcore50" ] } }, "tools": { "Microsoft.AspNetCore.Server.IISIntegration.Tools": { "version": "1.0.0-*", "imports": "portable-net45+wp80+win8+wpa81+dnxcore50" } }, "scripts": { "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" } }
原文:https://stackoverflow.com/questions/36749200
最满意答案
您可以使用
$routeProvider
服务。 当没有其他路由定义匹配时,可以使用otherwise
调用的方法来设置将在路由更改时使用的路由定义。
相关问答
更多-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
要以简单的方式实现延迟加载控制器,您必须执行以下操作: 保存$controllerProvider.register (这是将控制器添加到已启动的AngularJS应用程序中的唯一方法)到应用程序( main.js )中的变量: var app = angular.module('app',["ngRoute"]); app.config(['$routeProvider', '$controllerProvider', function($routeProvider, $controllerPro ...
-
你需要什么? 从URL获取哈希: 如何使用JavaScript检查URL中的#hash? 一旦你有了哈希,简单地获取带有哈希的id选择器的元素,然后: $(hash).modal('show') What do you need? Get the hash from the URL: How can you check for a #hash in a URL using JavaScript? Once you have the hash, simple get the element with the ...
-
NodeJS:如何在GET返回后加载HTML页面;(NodeJS: How to load HTML page after GET has returned; Angular.js not being found)[2023-05-31]
与其将这两者结合起来,最好将getData api分开,并在使用Angular获取index.html之后呈现数据。 现在为了得到这个工作,你可以保持index.html api的状态,并将getData api更改为'/ data'或其他适当的东西。 您没有提及$ http请求中的api网址,导致404 NOT FOUND错误。 将其更改为此并尝试: app.controller('SimpleController', function ($scope, $http) { $http.get('ht ... -
你需要$编译它: var runtimeBtn = $compile(angular.element(""))($scope); 在这里看到: http : //jsfiddle.net/7yqrjdkk/8/ 然而,一个更“角度”的方法是将它放在相同的控制器/范围内,并简单地使用ng-show ,如下所示: http : //jsfiddle.net/7yqrjdkk/9/ You need to $co ...
-
解决了我自己的问题。 这是一个非常小的错误,但从未实现过。 我需要初始化我的'优惠'。 我修改的编辑功能如下: $scope.Offer=new Offer(); .... $scope.editOffer = function (offerPassed) { $scope.Offer.$get({action:"get",id:offerPassed._id},function (Offer) { $('#show_offer_form_edit').toggleEditOffe ...
-
如何在angualr js中打开网站时加载特定页面(How to load a particular page when the website opens in angular js)[2023-10-27]
您可以使用$routeProvider服务。 当没有其他路由定义匹配时,可以使用otherwise调用的方法来设置将在路由更改时使用的路由定义。 这是相同的文档。 此外,他们在这里举例说明了这一点 。 You can use $routeProvider service. The method called otherwise can be used to set the route definition that will be used on route change when no other rou ... -
最初,您必须将导航设置为display:none并使其display:block媒体查询截止,您希望显示导航。 对于Eg: 在普通的桌面模式下:(最好把它放在你的css文件的顶行加载部分) nav { display:none; } 在小型设备中 @media screen and (max-width : 760px) { nav { display:block; } } Found the answer: https://github.com/viljamis/re ...
-
您的控制器与路由配置位于同一文件中,还是单独的文件? 如果它在一个额外的文件中,你必须更换 myApp.controller('RegistrationController',['$scope',function($scope){ 同 angular.module('myApp').controller('RegistrationController',['$scope',function($scope){ 如果它在同一个文件中,请在此处发布错误消息 Is your controller in the ...
-
使用指令是一种很好的方法,因为您可以将滑块附加到您想要的任何特定元素。 但是,您的指令具有硬编码的“slider-1”ID。 您希望它是动态的,因此您可以将其附加到任何元素: app.directive('mySlider', function() { return { link: function(scope, element){ $(element).liquidSlider({ autoSlide: true, ...