0
我創建了一個ASP.NET Core
應用:引用的類庫項目中的ASP.NET核心應用
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"EntityFramework.Commands": "7.0.0-beta8",
"EntityFramework.SqlServer": "7.0.0-beta8",
"EntityFramework.Core": "7.0.0-beta8",
"EntityFramework.SqlServer.Design": "7.0.0-beta8",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc.Abstractions": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.Core": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.DataAnnotations": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.WebApiCompatShim": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.ViewFeatures": "6.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"System.IdentityModel.Tokens.Jwt": "5.0.0-rc1-211161024",
"Microsoft.IdentityModel.Protocols": "2.0.0-rc1-211161024",
"ClassLibrary1": "1.0.0-*",
"InviteMoi.BLL": "1.0.0-*",
"InviteMoi.DAL": "1.0.0-*"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": {
"dependencies": {
"Microsoft.AspNet.Identity.EntityFramework": "2.2.1",
"Microsoft.AspNet.Identity.Owin": "2.2.1",
"Microsoft.AspNet.WebApi.Owin": "5.2.3",
"Microsoft.Owin.Cors": "3.0.1",
"Microsoft.Owin.Host.SystemWeb": "3.0.1",
"Owin": "1.0.0",
"Thinktecture.IdentityModel": "3.6.1",
"Thinktecture.IdentityModel.Client": "4.0.1"
},
"frameworkAssemblies": {
"System.Web": "4.0.0.0"
}
}
},
"exclude": [
"wwwroot",
"node_modules"
],
"publishExclude": [
"**.user",
"**.vspscc"
]
}
然後我添加了一個單元測試項目:
{
"version": "1.0.0-*",
"description": "InviteMoi.Test Class Library",
"authors": [ "lamloumiafif" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"net451": {
"dependencies": {
}
},
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
},
"dependencies": {
"NUnit": "3.2.1",
"EntityFramework.InMemory": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
"InviteMoi.BLL": "1.0.0-*",
"InviteMoi.DAL": "1.0.0-*"
}
}
的問題是,當我想喜歡在測試項目中添加Web應用程序的引用,它不起作用,並且出現異常表示ASP.NET Core的版本不能更高。
那麼我該如何解決這個問題呢?
相同,刪除dotnet5.4並將net451更改爲dnx451,就像它在應用程序中一樣。單元測試項目的應用程序與網絡應用程序的相同方式 –
@JoeAudette謝謝,請發表您的評論作爲答案:) –
我已經發布它作爲答案謝謝! –