question

27180912 avatar image
0 Votes"
27180912 asked JiachenLiMFST-9349 commented

.net6 引用 .net4的dll,.net4的dll依赖引用了4.0版本的dll

.net6 引用 .net4的dll,.net4的dll依赖引用了4.0版本的System.Windows.Forms.dll
运行后提示报错
263837-1669282265336.png


如何控制同时调用不同版本的dll,在app.config中天添加dependentAssembly节点无效
263844-image.png


dotnet-runtime
1669282265336.png (14.5 KiB)
image.png (27.3 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @27180912 ,
May I know if you have got any chance to check my answer? I am glad to help if you have any other questions.

0 Votes 0 ·

1 Answer

JiachenLiMFST-9349 avatar image
0 Votes"
JiachenLiMFST-9349 answered JiachenLiMFST-9349 edited

Hi @27180912 ,
As this is an English-language forum, it is recommended that you post questions in English.
You can refer to the solution below to configure your csproj and app.config file.

 <ItemGroup>
   <Content Include="..\lib\dll4\System.Windows.Forms.dll">
     <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     <Link>dll4\System.Windows.Forms.dll</Link>
   </Content>
   <Content Include="..\lib\dll6\System.Windows.Forms.dll">
     <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     <Link>dll6\System.Windows.Forms.dll</Link>
   </Content>
 </ItemGroup>

https://stackoverflow.com/a/50262213/17334287
Best Regards.
Jiachen Li


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.