使用 DNX 时的框架不兼容问题
Framework incompatibility issue when using DNX
我创建了一个 ASP.NET MVC 6 Web 应用程序项目 "OpsTools"。项目 json 文件是:
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Diagnostics": "1.0.0-beta6",
"Microsoft.AspNet.Mvc": "6.0.0-beta6",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta6",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta6",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta6",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta6",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta6",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta6",
"Microsoft.Framework.Logging": "1.0.0-beta6",
"Microsoft.Framework.Logging.Console": "1.0.0-beta6",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta6",
"EntityFramework": "6.1.3",
"jqGridWebApi": "1.1.4",
"OrionSharedObjects": "4.7.0.1",
"EnyimMemcached": "2.13.0",
"CouchbaseNetClient": "1.2.7",
"xunit": "2.2.0-beta1-build3239",
"Moq": "4.2.1510.2205"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini"
},
"frameworks": {
"dnx451": {
"frameworkAssemblies": {
"System.Data": "4.0.0.0"
}
}
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
},
"configurations": {
"Staging": { }
}
}
然后我在解决方案中添加一个新的class包库项目用于单元测试。我试图参考第一个项目。我发现第二个项目中的project.json是:
{
"version": "1.0.0-*",
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"dnx451": {
"dependencies": {
"OpsTools": "1.0.0-*"
}
},
"dnxcore50": { }
}
}
问题是我遇到了很多编译错误。基本上他们是
The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) OpsTools.Test.DNX Core 5.0 C:\Source\Optools\src\OpsTools.Test\Properties\AssemblyInfo.cs
因为项目使用的框架不同。它们是测试版并且不稳定。很难协调他们。我只是删除了第二个项目。
我创建了一个 ASP.NET MVC 6 Web 应用程序项目 "OpsTools"。项目 json 文件是:
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Diagnostics": "1.0.0-beta6",
"Microsoft.AspNet.Mvc": "6.0.0-beta6",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta6",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta6",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta6",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta6",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta6",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta6",
"Microsoft.Framework.Logging": "1.0.0-beta6",
"Microsoft.Framework.Logging.Console": "1.0.0-beta6",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta6",
"EntityFramework": "6.1.3",
"jqGridWebApi": "1.1.4",
"OrionSharedObjects": "4.7.0.1",
"EnyimMemcached": "2.13.0",
"CouchbaseNetClient": "1.2.7",
"xunit": "2.2.0-beta1-build3239",
"Moq": "4.2.1510.2205"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini"
},
"frameworks": {
"dnx451": {
"frameworkAssemblies": {
"System.Data": "4.0.0.0"
}
}
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
},
"configurations": {
"Staging": { }
}
}
然后我在解决方案中添加一个新的class包库项目用于单元测试。我试图参考第一个项目。我发现第二个项目中的project.json是:
{
"version": "1.0.0-*",
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"dnx451": {
"dependencies": {
"OpsTools": "1.0.0-*"
}
},
"dnxcore50": { }
}
}
问题是我遇到了很多编译错误。基本上他们是
The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) OpsTools.Test.DNX Core 5.0 C:\Source\Optools\src\OpsTools.Test\Properties\AssemblyInfo.cs
因为项目使用的框架不同。它们是测试版并且不稳定。很难协调他们。我只是删除了第二个项目。