Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I download a nuget package only for a specific platform?

I've recently added NLog into my solution and I've noticed that the packages\NLog.4.4.12\lib directory contains the following directories.

  • MonoAndroid10
  • net35
  • net40
  • net45
  • sl4
  • sl5
  • wp8
  • Xamarin.iOS10

My projects only target .net 4.0 and .net 4.5. How can I get rid of the rest? I searched in the VS 2017 nuget package manager but I couldn't find anything obvious.

like image 669
Stelios Adamantidis Avatar asked Nov 08 '22 12:11

Stelios Adamantidis


1 Answers

I manually removed the directories for the platforms that I didn't need. I've opened the solution with VS 2017 and it didn't complain. I've rebuilt the solution, again no complaint. I've reloaded the project that uses NLog, everything was golden. I've opened package manager, it didn't complain either. In all cases the directories did not reappear.

The only hiccup is that running Update-Package in Package Manager Console does not restore the previous state. But since I don't care about supporting other platforms in the future, I didn't bother finding a solution.

You can't call it a scientific solution, but since it's better than nothing, it's an answer for now.

like image 110
Stelios Adamantidis Avatar answered Nov 15 '22 06:11

Stelios Adamantidis