2016-01-13 79 views
1

enter image description here類庫引用不是在Asp.net工作5 MVC 6 web應用

的引用添加到項目SharpFitness幅因爲我們可以highlighted.However我的代碼是否顯示錯誤作爲在圖像中看到無法解析符號。

這裏是project.json文件

{ 
    "userSecretsId": "aspnet5-SharpFitnessWeb-1950ae2a-a3b9-4eaa-b94f-091f3d9afdfa", 
    "version": "1.0.0-*", 
    "compilationOptions": { 
    "emitEntryPoint": true 
    }, 

    "dependencies": { 
    "EntityFramework.Commands": "7.0.0-rc1-final", 
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final", 
    "Microsoft.ApplicationInsights.AspNet": "1.0.0-rc1", 
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final", 
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final", 
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final", 
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final", 
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final", 
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final", 
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final", 
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final", 
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final", 
    "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final", 
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final", 
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final", 
    "Repository": "1.0.0-*" 

    }, 

    "commands": { 
    "web": "Microsoft.AspNet.Server.Kestrel", 
    "ef": "EntityFramework.Commands" 
    }, 

    "frameworks": { 
    "dnx451": { 
     "dependencies": { 
     } 
    } 

    }, 

    "exclude": [ 
    "wwwroot", 
    "node_modules" 
    ], 
    "publishExclude": [ 
    "**.user", 
    "**.vspscc" 
    ], 
    "scripts": { 
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ] 
    } 
} 

的代碼示出了在project.json文件參考。我在這裏犯的錯誤是我整天搞清楚,但仍然無法解決問題。

這裏是倉庫的參考代碼

namespace Repository.Business.Interface 
{ 
    public interface IRepositoryServiceCall<T> where T: class 
    { 
     GenericResponseObject<T> RepositoryGet(string actionname, KeyValuePair<string, string> ketKeyValuePair); 
     GenericResponseObject<T> RepositoryPost(string actionname, T model); 
    } 
} 

庫project.json文件

{ 
    "version": "1.0.0-*", 
    "description": "Repository Class Library", 
    "authors": [ "ajaisy" ], 
    "tags": [ "" ], 
    "projectUrl": "", 
    "licenseUrl": "", 
    "frameworks": { 
    "net451": { } 
    }, 
    "dependencies": { 
    "ServiceLayer": "1.0.0-*" 
    } 
} 
+0

您的Repository項目是否使用比您的SharpFitnessWeb項目更高版本的.Net? –

+0

我已經添加了我的資源庫的project.json文件,請看看並讓我知道我認爲它只有最新版本 –

回答

2

對於此問題的原因是Net.Framework標籤重命名。查看更多https://github.com/aspnet/Home/issues/1047

你的倉庫使用

"frameworks": { 
    "net451": { } 
}, 

你的MVC應用程序使用

"frameworks": { 
    "dnx451": {} 
}, 

所以,你必須使用相同的框架標籤在兩個項目。

"frameworks": { 
    "dnx451": { }, 
    "dnxcore50": { } 
}, 
相關問題