混合模式组件内置于version“2.0.50727”的运行时,不能在4.0运行时加载能在、组件、加载、模式

2023-09-03 00:14:01 作者:猫言深林

我在使用Visual Studio 2012和.NET Framework 4.5 我有2个解决方案:1)WPF应用程序2)班库(DLL)

I'm using Visual Studio 2012 and the .Net Framework 4.5 I have 2 Solutions: 1) WPF Application 2) Class library (dll)

该类库包含了3个按键,而且必须是一个WindosFormsHost控件中,因为它是为的WinForms控制。

The Class Library contains 3 buttons and a control that has to be inside a WindosFormsHost control since it was made for WinForms.

.NET Framework的那些以外唯一引用的程序集是上述的WinForms控制和iTextSharp的。

The only referenced assemblies outside of the .NET Framework ones are for the aforementioned winforms control and iTextSharp.

本的WinForms控制似乎是有点老,当我把引用我的DLL我得到了同样的错误作为标题,但下列其他SO问题/答案,我在我的配置文件中把这个:

The winforms control seems to be kinda old and when I put the reference in my dll I got the same error as the title but following other SO questions/answers, my I put this in my config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true"> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>

错误:

混合模式组件建立对版本的运行时的V2.0.50727,不能在4.0运行时加载,无需额外配置信息

正如我所说,我已经看到了问题,发布这一问题,他们便在我的DLL项目解决的问题,但在项目中使用的DLL我已经试过都没有用。供参考:

As I mentioned, I've seen questions posting this issue, and they did solve the issue in my DLL project, but in the project using that DLL I've tried them all to no avail. For reference:

What 其他配置要引用一个.NET 2.0混合模式程序集在.NET 4.0的项目? Mixed模式组件构建针对运行时 版本V2.0.50727 What是'useLegacyV2RuntimeActivati​​onPolicy在.NET 4的配置呢? Mixed模式组件构建针对运行时的版本V2.0.50727',不能在4.0运行时的装 Mixed模式组件被内置于version X和不能在运行时的版本ÿ加载无需额外的配置信息的 What 'additional configuration' is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project? Mixed mode assembly is built against version ‘v2.0.50727′ of the runtime What does 'useLegacyV2RuntimeActivationPolicy' do in the .NET 4 config? Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime Mixed mode assembly is built against version X and cannot be loaded in version Y of the runtime without additional configuration information

在该项目中我的配置文件具有相同的价值观完全一样的标签。

In that project my config file has the exact same tags with the same values.

另外要注意,在我的WPF应用程序,一开始我得到它不能够找到指定的DLL(为的WinForms控制)的错误,最后我把那个控件的DLL在GAC。

Also to note, in my WPF Application, at the beginning I was getting an error about it not being able to find the specified dll (for the winforms control), in the end I put that control's dll in the GAC.

我试图改变我的目标框架,所有的可能性(4.5,4.0全和客户端,3.5全和客户端,3.0和2.0),构建我的DLL的调试和发布,并设置生成序列化程序集来关,也从任何CPU为x86和x64改变了目标平台。我只是试图改变在时间中的一个设定值。

I've tried changing my target framework for all of the possibilities (4.5, 4.0 full and client, 3.5 full and client, 3.0 and 2.0), building my DLL in debug and release and setting the "Generate serialization assembly" to OFF, also, changed the platform target from Any CPU to x86 and x64. I only tried changing the value of one setting at a time.

这是在VS2012的问题还是什么,我需要做的,解决这个问题?

Is this a problem in VS2012 or what do I need to do to solve this?

编辑:

上述错误显示在设计时的错误列表中,设计师给出一个错误说无法创建'my_class的实例

The above error is shown at design time in the errors list, the designer shows an error saying "Cannot create an instance of 'my_class'"

这是一个内部异常说:设置的ConnectionId抛出异常并在此内部异常是标题的消息

The inner exception of that one says: "Set connectionId threw an exception" and the inner exception of this is the title message.

这仍允许构建的解决方案,并在运行的应用程序,我得到基本相同,不同之处在于最里面的异常说:

This still allows the solution to be built, and upon running the application, I get basically the same, except that the innermost exception says:

无法加载文件或程序集SigPlusNET,版本= 1.1.3358.14336文化=中性公钥= 6aef07010bb0624f'或它的一个依赖项。试图用不正确的格式加载程序。

这一个是的WinForms控件的程序,在通过dotPeek检查,它具有唯一的依赖是.NET框架的人

That one is the winForms control's assembly, upon inspection through dotPeek, the only dependencies it has are .NET Framework ones

推荐答案

与(C $ CPLEX Bling的UI工具包为$)金光闪闪支持DirectX 10.0,工作。我在这里结束我此页寻找解决方案上的错误,在D3D10.example app.config文件包含了支持的运行时,版本= 4行。不过,这并不包括后来行版本= 2 .NET线,使用的app.config为:

Working with Bling for DirectX 10.0, (Bling UI Toolkit at CodePlex). I got the error that ended me up here on this page looking for the solution, the app.config file in the D3D10.example included the supported runtime, version=4 line. But it does NOT include a later line for the version=2 .net line, using the app.config as:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0" />
  <supportedRuntime version="v2.0.50727" />
 </startup>
</configuration>

解决了这个问题,并运行在VS2012所有的例子,一旦配置文件被修改为显示的code。

solved the problem, and all examples run in VS2012 once the config file is modified to the code shown.

我不知道这个帖子是迟到了一个答案,我只是在本月开始在Windows 7和VS2012在图形项目和配置变化解决我的问题。

I don't know if this post is to late for an answer, I'm just starting in windows 7 and VS2012 this month on a graphics project and the config change solved my problem.