我将VS2015升级到asp.net 5 beta7无法加载文件或程序集dnx.clr.managed或其依赖项之一 [英] Upgrading VS2015 to asp.net 5 beta7 I get Could not load file or assembly 'dnx.clr.managed' or one of its dependencies

查看:51
本文介绍了我将VS2015升级到asp.net 5 beta7无法加载文件或程序集dnx.clr.managed或其依赖项之一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照 https://github.com/aspnet/Home 上的说明升级了DNX.我还下载了Visual Studio 2015的DotNetVersionManager-x64.msi,但是当我创建一个新项目并运行网站时,出现以下错误

I have upgraded DNX using the instructions on https://github.com/aspnet/Home I also downloaded DotNetVersionManager-x64.msi for visual studio 2015 but when I create a new project and run the website I get the following error

Could not load file or assembly 'dnx.clr.managed' or one of its dependencies. The system cannot find the file specified. 

当我尝试从dnx命令行运行网站时,得到以下消息

When I try to run the website from dnx command line I get the following

C:\ code> dnx网站stem.InvalidOperationException:类型'Microsoft.Framework.Runtime.IApplicationEnvironment'的任何服务均未注册太累了.在Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider提供程序,Ty服务类型)在Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService [T](IServiceProvider提供程序)

C:\code> dnx web stem.InvalidOperationException: No service for type 'Microsoft.Framework.Runtime.IApplicationEnvironment' has been reg tered. at Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Ty serviceType) at Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider)

-从引发异常的先前位置开始的堆栈结束跟踪-在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()在Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(程序集程序集,String []参数,IServiceProvider服务ovider)在Microsoft.Dnx.ApplicationHost.Program.ExecuteMain(DefaultHost主机,字符串applicationName,字符串[] args)在Microsoft.Dnx.ApplicationHost.Program.Main(String [] args)-从引发异常的先前位置开始的堆栈结束跟踪-在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()在Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(程序集程序集,String []参数,IServiceProvider服务ovider)在Microsoft.Dnx.Host.Bootstrapper.RunAsync(列表1 args,IRuntimeEnvironment env,FrameworkName targetFramework)在Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String [] args,FrameworkName targetFramework)在Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String [] args,FrameworkName targetFramework)

at Microsoft.AspNet.Hosting.Program.Main(String[] args) - End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider service ovider) at Microsoft.Dnx.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args) at Microsoft.Dnx.ApplicationHost.Program.Main(String[] args) - End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider service ovider) at Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, FrameworkName targetFramework) at Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, FrameworkName targetFramework) at Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, FrameworkName targetFramework)

推荐答案

好像beta7不再包含 dnx.clr.managed.dll (及其依赖项).我已经通过以下步骤解决了这个问题:

Looks like beta7 doesn't carry the dnx.clr.managed.dll anymore (and its dependencies). I've solved this problem with the following steps:

您可以通过在 global.json 中查找以下节点来检查您的 global.json 文件是否期望beta7:

You can check if your global.json file is expecting beta7 by looking for the following node in global.json:

"sdk": {
        "version": "1.0.0-beta7",
        "runtime": "clr",
        "architecture": "x86"
    }

如果您的项目一直在寻找 dnx.clr.managed.dll (及其依赖项),则可以手动编辑 project.json 文件(该文件存储了依赖项并替换旧的 cs.proj vb.proj 文件),以指向预期的dnx运行时版本,例如:

If your project keeps looking for the dnx.clr.managed.dll (and its dependencies), you can manually edit your project.json file (which stores the dependencies and replaces the old cs.proj and vb.proj files), to point to the expected dnx runtime version, for example:

"dependencies": {
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta5",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta5"
  },

被编辑为:

"dependencies": {
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta7",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta7"
  },

保存更改后,您必须还原.一种方法是使用终端(CMD)导航到 ProjectName/src/ProjectName/文件夹( project.json 文件所在的文件夹),然后执行

After saving the changes, you have to restore the dependencies. One way is to navigate with terminal (CMD) to the ProjectName/src/ProjectName/ folder (where the project.json file is located), and execute the

dnu restore

命令.希望它将成功请求新的依赖项,您就可以开始了.

command. Hopefully it will request the new dependencies successfully, and you are ready to go.

PS .:我没有尝试使用x64安装程序运行,因为免费/共享应用程序可能与64位平台安装程序不兼容.如果我错了,请随时纠正我.

PS.: I didn't try to run with x64 setup, since free/shared apps might(?) not be compatible with 64 bit platform setup. Feel free to correct me if I'm wrong about it.

这篇关于我将VS2015升级到asp.net 5 beta7无法加载文件或程序集dnx.clr.managed或其依赖项之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆