none
How to install 4.5 framework NuGet package in 4.6 .NET framework project using Powershell ? RRS feed

  • Question

  • The following example shows a folder structure that supports four versions of a library:

        \lib    
           \net45
              \MyAssembly.dll
           \net46
               \MyAssemblycore.dll

    We have 4.6 .Net framework project. How to install NuGet package and refer MyAssembly.dll in that project? 

    Its possible to install different framework in 4.6 .NET framework project? 
    Can you please suggest any other solution ?
    Monday, July 17, 2017 9:31 AM

All replies

  • We have 4.6 .Net framework project. How to install NuGet package and refer MyAssembly.dll in that project? 

    The following example shows a folder structure that supports four versions of a library:

        \lib    
           \net45
              \MyAssembly.dll
           \net46
               \MyAssemblycore.dll


    Its possible to install different framework in 4.6 .NET framework project? 
    Can you please suggest any other solution ?
    Monday, July 17, 2017 9:26 AM
  • Hi Dheeps,

    Thank you for posting in MSDN forum.

    This forum is discussing about VS setup and installation, I help you merge this case to another one in general forum for a much professional support.

    Thank you for your understanding.

    Best Regards,


    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, July 18, 2017 2:50 AM
    Moderator
  • Hi Dheeps,

    Thanks for posting here.

    >>>Its possible to install different framework in 4.6 .NET framework project? 

    Yes, you can do that, but I do not recommend it.

    You can use NuGet Package Explorer to add the MyAssembly.dll to the net46 folder, then you can install the MyAssembly.dll in the 4.6 .NET framework. But if want to install the MyAssembly.dll in the net45 folder in 4.6 .NET framework project, that should be a long way to go. That because when NuGet installs an assembly from a package, it checks the target .NET Framework version of the project, then selects the correct version of the assembly from the appropriate subfolder under lib in the package. So if you want to install different framework in 4.6 .NET framework project without any manually, you need to change the modify the design of nugget.

    Besides, each dll under the \net folder is based on a different .Net framework development, and each .net framework is not compatible with each other, so if you install the different framework in one .NET framework project, you may get incompatible errors for the dll files. So I do not recommend it. But if you still want to do that, you can try the method which I have provided.

    Hope this can help you.


    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, July 18, 2017 5:58 AM