none
[UWP] How To Import .NET Framework Library RRS feed

  • Question

  • Hello All,

    I see a few postings about our ability to import a .NET Framework library, but when I do it I get the following error.  I upgraded my project to Microsoft.NETCore.UniversalWindowsPlatform 5.2.2 and added the "netstandard1.6" import, but I get these two error before I even add a .NET Framework assembly:

    1. C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
    2. C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0\8.2\Microsoft.Windows.UI.Xaml.Common.targets(264,5): Xaml Internal Error error WMC9999: Object reference not set to an instance of an object.

    Thursday, October 20, 2016 1:33 AM

All replies

  • Hi Rashad,

    As far as I know, UWP(10.0) is based on netstandard1.4. “netstandard1.6” contains some different APIs that you could not use in UWP(10.0). May I ask why you want to use the “netstandard1.6” library? As described in following blog, .Net Standard is not used for app context directly.
    Applications. In the context of applications you don’t use .NET Standard directly. However, you still benefit indirectly. First of all, .NET Standard makes sure that all .NET platforms share the same API shape for the base class library. Once you learn how to use it in your desktop application you know how to use it in your mobile application or your cloud service. Secondly, with .NET Standard most class libraries will become available everywhere, which means the consistency at the base layer will also apply to the larger .NET library ecosystem.”
    https://blogs.msdn.microsoft.com/dotnet/2016/09/26/introducing-net-standard/ 

    Best Regards,
    David

    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

    Monday, October 24, 2016 5:57 AM
  • David_FF,

    I'm just exploring the limits of what can be done.  I'm porting over a large amount of X509Certificate2 and PInvoke logic from a WPF application and if any of the existing code can be utilized in UWP, I need to know.  For the most part, the following features are what I'm looking for:

    1. Ability to enumerate Enhanced Key Usage attributes in certificates: particularly the OID(s) marking the certificate's intended capabilities
    2. Ability to enumerate Subject Alternative Names: such as RFC822, DSObject (AKA Guid)
    3. Ability to perform SmartCard configurations: we use a specific C++ PInvoke routine to compute the challenge, read/write files, read/write containers, set custom SmartCard roles (meaning besides Admin and User)

    I'm just getting familiar with UWP, but it seems that certain advanced capabilities will have to remain within .NET Framework which is unfortunate because it would be nice to have a total porting of the solution to UWP. 

    BTW: The netstandard1.4 did not work either.  I'm reading through the article you posted (Introduction to .NET Standard), and it would seem to me that the solution is to use a SharedProject and reference that in my UWP head.  Then we should port in (class-by-class), the functionality we need.  Is this a correct assessment of what we should do?  For some reason the practicality of this article escapes me.


    - Rashad Rivera www.omegusprime.com






    Monday, October 24, 2016 1:20 PM
  • Hi Rashad,
    For question 1 and question 2, as far as I know, X509Certificate2 is contained in the list of supported .Net APIs for UWP. Please refer to the following link.
    https://msdn.microsoft.com/en-us/library/mt185488.aspx
    For the third question about smartcard, if you choose to use P/Invoke, first of all you need to check the lists of  Win32 and COM APIs for UWP:
    https://msdn.microsoft.com/en-us/library/windows/apps/mt592904.aspx
    This would help us to check whether the API is supported in UWP app.
    You can also refer to UWP API about smartcard: https://msdn.microsoft.com/en-us/windows/uwp/security/smart-cards

    >> Is this a correct assessment of what we should do?
    For this I think you need to check the following blog to compare shared project and PCL first:
    https://blogs.msdn.microsoft.com/dotnet/2014/04/21/sharing-code-across-platforms/
    Then you may have an idea about whether you need to use shared project.
    By the way, as you are trying to port your exist desktop app to UWP. I think “porting apps to Windows 10” is a good article for your reference:
    https://msdn.microsoft.com/vi-vn/windows/uwp/porting/index 

    Best Regards,
    David


    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

    Tuesday, October 25, 2016 10:34 AM