从源代码使用MVC时,为什么找不到"Method.Void Microsoft.AspNet.Hosting.HostingEnvironment..ctor()"方法? [英] Why am I getting Method not found: 'Void Microsoft.AspNet.Hosting.HostingEnvironment..ctor()' when using MVC from source?

查看:56
本文介绍了从源代码使用MVC时,为什么找不到"Method.Void Microsoft.AspNet.Hosting.HostingEnvironment..ctor()"方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 https://github.com/aspnet/Mvc 下载了MVC的源在ASP.NET 5 Starter Web项目中,我在解决方案级别添加了global/global.json.

I downloaded the source for MVC from https://github.com/aspnet/Mvc and in a ASP.NET 5 Starter Web project I added global/global.json at the solution level.

global.json中,我指出了MVC的来源:

In global.json I pointed to where the MVC source is:

{
    "sources":  [ "C:\\development\\github\\Mvc\\src" ]
}

当我构建并运行项目时,我会得到:

When I build and run the project I am getting:

谁能指出我可能做错了什么?我希望能够运行ASP.NET项目并调试MVC.

Can anyone point out what I might be doing wrong? I would like to be able to run an ASP.NET project and debug MVC.

推荐答案

在这里盲目射击,但这是使用来源时最常见的问题:请确保您使用的包和来源来自同一提要/分支

Shooting blind here but this is the most common issue when it comes to using sources: make sure you are using the packages and the sources from the same feed/branch.

当您从ASPNET的GitHub存储库克隆源代码时,对于大多数存储库,默认分支为dev.该分支中的代码对应于MyGet( https://www.myget. org/F/aspnetvnext/api/v2 )而不是NuGet.

When you clone the sources from ASPNET's GitHub repos, for most repos the default branch is dev. The code in that branch, corresponds to the packages from MyGet (https://www.myget.org/F/aspnetvnext/api/v2) not NuGet.

但是,如果您将NuGet的程序包与dev分支中的代码一起使用(反之亦然),则将确保像您看到的那样遇到奇怪的错误(缺少方法,不正确的参数等).

However, if you use the packages from NuGet with the code in the dev branch (or vice versa), you will mostly sure hit strange errors (missing methods, incorrect parameters, etc) like you are seeing.

这篇关于从源代码使用MVC时,为什么找不到"Method.Void Microsoft.AspNet.Hosting.HostingEnvironment..ctor()"方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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