浏览到.NET框架目录以引用更高版本的asssemblies:请指教。 [英] Browsing to NET framework directory to reference higher version asssemblies: please advise.

查看:159
本文介绍了浏览到.NET框架目录以引用更高版本的asssemblies:请指教。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很长一段时间没有问过这个问题,但是这两个问题是如此有先见之明,如果这个问题在某些时候没有出现在很多(如果不是大多数)CP的人的经验中,我会感到非常惊讶。指出他们使用Visual Studio的经历。



首先,有没有人曾经浏览过(不做.NET参考)到Microsoft Framework(.NETFramework)目录来制作一个引用一个比它们通过运行版本的Visual Studio可访问的程序集的顶级版本更高阶的CLR程序集?



第二,有没有人遇到了使用代码来成功编译CLR程序集的不可思议的能力,这些代码被设计为访问较新版本的.NET Framework的功能,因为代码没有引用该较新框架的任何新的不动产,即:通过引用的新功能或者其他?



这些是因为我完全停在了我的轨道上得到一个通过TSQL执行注册的.dll,允许我很好地运行SQL Server ......然后当Windows通过Procedure EXECUTE第一次调用Assembly时停止给定的程序集名称或代码库无效时停止。



或者我的皮肤太薄,周五比它需要的更难?



< b>我尝试了什么:



(Wendelius'优秀'从数据库写入文件'......通过删除它的内脏来消除VS2013项目在VS2010项目中以Frankestein-方式重新组装它们,并尝试通过ssmse脚本执行运行代理生成的.dll(再次由Wendelius提供的精彩.sql脚本))

I haven't asked a question for a long time but these two are so prescient that I'd be very surprised if the matter hadn't come up at some time in the experiences of many if not most CPians here at some point in their experiences using Visual Studio.

First, has anyone ever BROWSED (not made an .NET ref) to the Microsoft Framework (.NETFramework) directory to make a reference to a CLR assembly of higher order than the top-level version of the assembly accessible to them through their running version of Visual Studio?

And second, has anyone ever encountered the uncanny ability to successfully compile a CLR assembly using code that was presumeably designed to accesss functionality of a newer version of .NET Framework because the code doesn't reference any new real-estate of that newer Framework, ie: functionality through references new or otherwise?

These because I'm completely stopped in my tracks by being able to get a .dll that registers through a TSQL execution, allows me to run SQL Server nicely ... and then halts when the first call to the Assembly through Procedure EXECUTE gets told by Windows that "The given assembly name or codebase was invalid."

Or am I just too thinned skin and making Friday harder than it needs to be?

What I have tried:

(Wendelius' excellent "Writing into a file from databse" ... gutting the VS2013 project by removing it's innards, and reassembling them in Frankestein- fashion in a VS2010 project, and attemping to run the .dll produced by proxy through ssmse script execution (again wonderful .sql script provided by Wendelius))

推荐答案

你不能在你的应用程序中使用高于你的应用程序所针对的框架版本的程序集。



虽然你可能会发现这样的情况工作,有很多情况下它不会,而且似乎你刚刚发现了一个。



如果您的应用程序针对的是.NET 2.0,则特别如此3.0或3.5,并尝试使用任何.NET 4.x版本的程序集。





Don做T这一点。这不值得。
You cannot use assemblies in your app that target a Framework version higher than the one your app is targeting.

While you may find cases were this will work, there are plenty of cases where it won't, and it seems you just found one.

This is specially so if your app is targeting .NET 2.0, 3.0, or 3.5, and your trying to use an assembly from any of the .NET 4.x versions.


Don't do this. It's not worth it.


这篇关于浏览到.NET框架目录以引用更高版本的asssemblies:请指教。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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