none
Why "System.Environment.GetFolderPath(SpecialFolder)" method is not found in during run time? RRS feed

  • Question

  • Hi,

    I have a Progressive Web App(Universal Windows) which uses a Windows Runtime Component(Universal Windows). This Windows Runtime Component(Universal Windows) uses a.Net Standard  library(.dll).

    Properties of Progressive Web App(Universal Windows):

    After running Progressive Web App(Universal Windows), a button appears and when we click this button below code snippet executes in which a method from Windows Runtime Component(Universal Windows) is called.

    function onClickbtn()
    {
      var strPath=WinMDComponent.WinMDComp.getPath();
    }

    In Windows Runtime Component(Universal Windows) project i have the below code which calls a method from the .Net Standard library:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace WinMDComponent
    {
        public sealed class WinMDComp
        {
            public static string getPath()
            {
                return NetStandard2Component.NetStand2Comp.getDataPath();
            }
        }
    }

    in .Net Standard project i have the below code:

    using System;
    
    namespace NetStandard2Component
    {
        public class NetStand2Comp
        {
            public static string getDataPath()
            {
                return Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            }
        }
    }
    

    Problem Description:

    1. If i keep the minimum version of Windows Runtime Component(Universal Windows) project as 10240 (Target Version is always 16299) , i had to add "netstandard.dll" as a reference in Windows Runtime Component(Universal Windows) project and after running Progressive Web App(Universal Windows) project i got below error:

    2. if If i keep the minimum version of Windows Runtime Component(Universal Windows) project as 16299 (Target Version is always 16299) , i don't need to add "netstandard.dll" as a reference in Windows Runtime Component(Universal Windows) project and if run Progressive Web App(Universal Windows) project i got below error:

    Can anyone help me to solve this problem?



    Pallam Madhukar - Windows UWP/WPF Application Developer

    Wednesday, March 4, 2020 11:40 AM

All replies

  • Hi Pallam Madhukar,

    Thank you for posting here.

    According to your description, your issue is more related to UWP. Therefore, it will be more appropriate to ask your question in UWP Forums

    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao


    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.

    Thursday, March 5, 2020 2:43 AM