简体   繁体   English

从aspnet5引用“旧”.NET 4.x DLL?

[英]Reference “old” .NET 4.x DLL from aspnet5?

I wonder if I can use an "old" .NET 4.5.x DLL, which depends on System.Web.Mvc v4.0.0.0 in an aspnet5 (MVC6) project. 我想知道我是否可以使用“旧的”.NET 4.5.x DLL,它依赖于aspnet5(MVC6)项目中的System.Web.Mvc v4.0.0.0。 I have an external library with lots of Html helpers that I would like to use. 我有一个外部库,里面有很多我想使用的Html助手。 Is this at all possible? 这是可能吗?

I try referencing the DLL, but I get the following compiler error, which makes sense: 我尝试引用DLL,但我得到以下编译器错误,这是有道理的:

CS0012 The type 'HtmlHelper' is defined in an assembly that is not referenced. CS0012类型'HtmlHelper'在未引用的程序集中定义。 You must add a reference to assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 您必须添加对程序集'System.Web.Mvc,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'的引用

Is there any way to do this? 有没有办法做到这一点?

According to Damien Edwards on the ASP.NET team, this is not possible, since the underlying types have changed, not just the namespaces. 根据ASP.NET团队的Damien Edwards的说法,这是不可能的,因为底层类型已经改变,而不仅仅是名称空间。

(Twitter is the source of all the best aspnet5 knowledge, it's moving so fast...): (Twitter是所有最好的aspnet5知识的来源,它的移动速度如此之快......):

https://twitter.com/erikbra/status/575369567549132801 https://twitter.com/erikbra/status/575369567549132801

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM