我正在尝试使用Azure表存储的EF 7的示例在VS 14 CTP3中工作,但我对依赖注入的东西没有运气。我能够很容易地得到一个SQL的例子,但是我看到一个没有意义的问题:引用的包在那里并被拉入,如果我看一下,它包含正确的命名空间,方法,clases等,但编译不喜欢它。
这是我的project.json:
{ "dependencies": { "Microsoft.AspNet.Server.IIS": "1.0.0-alpha3", "EntityFramework.AzureTableStorage": "7.0.0-alpha3", "Microsoft.AspNet.RequestContainer": "1.0.0-alpha3" }, "frameworks" : { "net451" : { }, "k10" : { } } }
using System; using Microsoft.AspNet.Builder; using Microsoft.Data.Entity; /* <- 'missing reference' unless I add EntityFramework to project.json */ using Microsoft.Data.Entity.AzureTableStorage; /* <- ALWAYS errors w/ 'missing reference' */ using Microsoft.Framework.DependencyInjection; namespace WebApplication2 { public class Startup { public void Configure(IBuilder app) { app.UseServices(services => { services.AddEntityFramework() /* <-- this errors too */ .AddAzureTableStorage(); services.SetupOptions<DbContextOptions> //,- says it can't find this (config => config.UseAzureTableStorage("UseDevelopmentStorage=true")); }); } } }
奇怪的是,如果我右键单击并对任何“缺失的”类或方法进行“定义”,它会启动它们,我可以看到我按照定义使用它们。我错过了一些非常明显的东西吗?或者这些东西还没有完全煮熟?
答案 0 :(得分:1)
你的project.json有两个提到的框架,所以VS构建了它们。如果您的目的是为net451构建,则应从project.json中删除以下内容 - &#34; K10&#34; :{}