none
[UWP] Cannot use AppCenter and class RuntimeInformation at the same time in different assemblies RRS feed

  • Question

  • Hi,

    I have a C# UWP app with 2 projects. One project (the app) includes the AppCenter nuget packages. The 2nd project is a RuntimeComponent, which doesn't access to the AppCenter, but read some information from the System.Runtime.InteropServices.RuntimeInformation class. So I added the reference of System.Runtime.InteropServices.RuntimeInformation to the 2nd project. But this reference is only available in version 4.0.1.0. Project 2 is added as reference to project 1, that project 1 has access to it.

    On installing the AppCenter nuget packages, I can see, that System.Runtime.InteropServices.RuntimeInformation.4.0.0.0 will be installed:

    If I build project 1, I get the following warning with code MSB3277:

    1>------ Rebuild All started: Project: RuntimeComponent1, Configuration: Debug x64 ------
    1>  RuntimeComponent1 -> D:\VS Community 2017\MyProjects\Test\DLLVersionConflict\RuntimeComponent1\bin\x64\Debug\RuntimeComponent1.winmd
    2>------ Rebuild All started: Project: DLLVersionConflict, Configuration: Debug x64 ------

    2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3277: Found conflicts between different versions of "System.Runtime.InteropServices.RuntimeInformation" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.

    2>  DLLVersionConflict -> D:\VS Community 2017\MyProjects\Test\DLLVersionConflict\DLLVersionConflict\bin\x64\Debug\DLLVersionConflict.exe

    ========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========

    But I can execute the app, and when I call a method in the RuntimeComponent, which accesses to RuntimeInformation class properties, I get the following System.IO.FileLoadException:

    Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    Then I removed the AppCenter nuget packages from project 1, added System.Runtime.InteropServices.RuntimeInformation (version 4.0.1.0) as reference and then added the AppCenter nuget packages again. Now I get the following output with code MSB3243:

    1>------ Rebuild All started: Project: RuntimeComponent1, Configuration: Debug x64 ------
    1>  RuntimeComponent1 -> D:\VS Community 2017\MyProjects\Test\DLLVersionConflict\RuntimeComponent1\bin\x64\Debug\RuntimeComponent1.winmd
    2>------ Rebuild All started: Project: DLLVersionConflict, Configuration: Debug x64 ------

    2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3243: No way to resolve conflict between "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.

    2>  Consider app.config remapping of assembly "System.Runtime.InteropServices.RuntimeInformation, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.0.0" [C:\Users\Heiko\.nuget\packages\system.runtime.interopservices.runtimeinformation\4.0.0\ref\netstandard1.1\System.Runtime.InteropServices.RuntimeInformation.dll] to Version "4.0.1.0" [C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\System.Runtime.InteropServices.RuntimeInformation.dll] to solve conflict and get rid of warning.

    2>D:\VS Community 2017\MyProjects\Test\DLLVersionConflict\DLLVersionConflict\MainPage.xaml.cs(31,43,31,61): error CS0433: The type 'RuntimeInformation' exists in both 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

    2>D:\VS Community 2017\MyProjects\Test\DLLVersionConflict\DLLVersionConflict\MainPage.xaml.cs(31,90,31,108): error CS0433: The type 'RuntimeInformation' exists in both 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

    ========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

    Is it possible to solve this issue with a file app.config? I tried it, but it doesn't change anything.

    I downloaded the AppCenter sources. But on all places where System.Runtime.InteropServices.RuntimeInformation is mentioned, are only higher versions than 4.0.0.0 mentioned.

    How can I solve this problem?

    Best Regards,

    Heiko

    Thursday, May 30, 2019 2:57 PM

All replies

  • Hi,

    Since the problem is more related to AppCenter, we do suggest you to ask about this question in AppCenter's FeedBack. You could refer this link about how to contact the AppCenter's support team:Help and Feedback

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, May 31, 2019 2:50 AM