我按照步骤这里从ASP.NET 5 Beta 4的升级到Beta版5,但我打电话时, application.UseBrowserLink()得到一个运行时错误;
:
I have followed the steps here to upgrade from ASP.NET 5 Beta 4 to Beta 5 but am getting an error at runtime when calling application.UseBrowserLink();
:
类型'System.TypeLoadException'的异常发生 mscorlib.dll中,但没有在用户code处理
An exception of type 'System.TypeLoadException' occurred in mscorlib.dll but was not handled in user code
更多信息:未能加载类型 从程序集Microsoft.AspNet.Builder.IApplicationBuilder Microsoft.AspNet.Http,版本= 1.0.0.0,文化=中立, 公钥=空'。
Additional information: Could not load type 'Microsoft.AspNet.Builder.IApplicationBuilder' from assembly 'Microsoft.AspNet.Http, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
这些是我遵循的步骤:
在已经安装了VS 2015年RC。 从PowerShell中运行: $ ENV:DNX_FEED =https://www.nuget.org/api/v2
从PowerShell中运行: dnvm升级
添加一个Global.json文件(我不已经有一个)。当我把它添加,它指的是测试版已经5:
Had VS 2015 RC already installed.
From PowerShell run:
$env:DNX_FEED="https://www.nuget.org/api/v2"
From PowerShell run: dnvm upgrade
Added a Global.json file (I did not already have one). When I added it, it referred to Beta 5 already:
{
"projects": [ "Source", "Tests" ],
"sdk": {
"version": "1.0.0-beta5-12103"
}
}
更新的包在project.json到Beta版5.你可以看到一个完整版我project.lock.json文件的这里。
{
"dependencies": {
"Boilerplate.Web.Mvc6": "1.0.2",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta5",
"Microsoft.AspNet.Mvc": "6.0.0-beta5",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta5",
"Microsoft.AspNet.Mvc.Xml": "6.0.0-beta5",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta5",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta5",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta5",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta5",
"Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-beta5",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta5",
"Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta5",
"Microsoft.Framework.Logging": "1.0.0-beta5",
"Microsoft.Framework.Logging.Console": "1.0.0-beta5",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta5",
"Newtonsoft.Json": "6.0.6",
"System.Runtime": "4.0.20-beta-23019"
}
"frameworks": {
"dnx451": {
"frameworkAssemblies": {
"System.Net.Http": "4.0.0.0",
"System.ServiceModel": "4.0.0.0"
}
},
"dnxcore50": {
"dependencies": {
"System.Net.Http": "4.0.0-beta-23019"
}
}
}
}
的说明,然后继续说,你应该运行下面的命令,但我相信VS 2015 RC为您完成此 DNU恢复
然后 DNU构建
。
The instructions then go on to say you should run the following commands but I believe VS 2015 RC does this for you dnu restore
then dnu build
.
更新
有似乎与浏览器链路的问题,评论线路输出允许工作现场。它可能被打破?需要寻找周围的ASPNET GitHub的问题。
It seems to be a problem with browser link, commenting the line out allows the site to work. It may be broken? Need to hunt around the aspnet GitHub issues.
推荐答案
为了帮助您从BETA4迁移到beta5的,这些都是我花了下面的步骤,根据研究/调查结果。
In order to help you migrate from beta4 to beta5, these are the following steps it took me, based on the research/findings.
在PowerShell中运行: $ ENV:DNX_FEED =https://www.nuget.org/api/v2
在PowerShell中运行: dnvm安装1.0.0-beta5的
在PowerShell中运行: dnvm使用1.0.0-beta5的-p
(不知道,如果它需要的,但是我不得不的)
PowerShell run: $env:DNX_FEED="https://www.nuget.org/api/v2"
PowerShell run: dnvm install 1.0.0-beta5
PowerShell run: dnvm use 1.0.0-beta5 -p
(not sure if its needed however i had to)
打开global.json和更新的SDK 1.0.0-beta5的应该是这样的:
Open global.json and update sdk to 1.0.0-beta5 should look like this:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta5"
}
}
打开project.json:
Open project.json:
从BETA4更新依赖版本beta5的修改配置依赖来自:
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4"
到
"Microsoft.Framework.Configuration": "1.0.0-beta5",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta5"
删除 Microsoft.VisualStudio.Web.BrowserLink.Loader
重命名 _GlobalImport.cshtml
到 _ViewImports.cshtml
Remove Microsoft.VisualStudio.Web.BrowserLink.Loader
Rename _GlobalImport.cshtml
to _ViewImports.cshtml
更改配置重大更改
Change Configuration breaking changes
更改从命名空间使用Microsoft.Framework.ConfigurationModel;
到使用Microsoft.Framework.Configuration;
修改 Configuration.GetSubKey
到 Configuration.GetConfigurationSection
更改CTOR为:
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
{
// Setup configuration sources.
var configBuilder = new ConfigurationBuilder(appEnv.ApplicationBasePath)
.AddJsonFile("config.json")
.AddEnvironmentVariables();
Configuration = configBuilder.Build();
}
删除 app.UseBrowserLink();
Remove app.UseBrowserLink();
DNU恢复
运行 DNU建
关闭并重新打开VS在这一点有时帮助。
Open PowerShell within app root
Run dnu restore
Run dnu build
Closing and reopening VS at this point helps sometimes.
我自己觉得这是很困难的升级现有的项目,找不到所需的所有在一起的所有步骤。 希望它可以帮助!
Myself found it quite difficult to upgrade an existing project, couldn't find all steps required all together. Hope it helps!
相关推荐
最新文章