0

Question: Where in Windows 10 we can find Windows.Management.Deployment.dll or how can we install it?

In a WinForm project in VS2017 - ver 15.9.6 I'm trying to follow C# example of PackageManager.FindUsers(String) method that uses classes from Windows.Management.Deployment namespace.

But can't seem to find the location of above dll that is needed to add a reference in VS2017 project. I installed UwpDestop NuGet package, also add a reference to windows.winmd file, but that did not help either. I'm using Windows 10 Pro- Update 1809.

Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51
nam
  • 21,967
  • 37
  • 158
  • 332
  • Possible duplicate of [How to access the Windows.Management.Deployment namespace?](https://stackoverflow.com/questions/13016645/how-to-access-the-windows-management-deployment-namespace) – preciousbetine Jan 31 '19 at 06:06

1 Answers1

10

In your Winforms project you need to go to "Add Reference …" and hit the "Browse" button. Then navigate here and select the Windows.winmd file that corresponds to the Windows SDK you are targeting. Be sure to change the file extension filter to .

enter image description here

Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51
  • As I mentioned in my post, I've already added `Windows.winmd`. I've Windows 10 - `update 1809` that probably means I'm targeting SDK [10.0.17763](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk). So, I chose `C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17763.0` folder for `Windows.winmd`. `10.0.17763.0` is the latest version folder inside `UnionMetadata` – nam Jan 31 '19 at 14:09
  • Adding the Windows.winmd is all you need. Don't use the Nuget package, it is outdated. Make sure you use a current version of the .NET Framework. Here is my test project - can you share yours that shows it doesn't work? https://1drv.ms/u/s!AovTwKUMywTNsOk9z5EKp_Qth5wF8A – Stefan Wick MSFT Jan 31 '19 at 16:16
  • 1
    In your test project you are using `Windows.Management.Deployment.PackageManager`, whereas; in the `C#` example of the link I provided in my post above, they are using `using Windows.Deployment.PackageManager;`. I tried your suggestion `Windows.Management.Deployment.PackageManager` and it works fine. (thank you). Is the MS online C# example using wrong `using` statement, maybe a typo on their example? Because their `using` statement still does not work even in your test project. Regardless, later I'm going to mark your response as an answer since it resolved my issue; – nam Feb 01 '19 at 01:01
  • This is a doc bug. Windows.Deployment.PackageManager is an old thing (from Windows Phone 8, if I remember correctly). Please use Windows.Management.Deployment.PackageManager. – Stefan Wick MSFT Feb 01 '19 at 01:15
  • 1
    Note, this process is now deprecated in .NET 5 onwards. Microsoft has made breaking changes where they explain here https://aka.ms/netsdk1130 – Kyle Sep 23 '21 at 13:56
  • 1
    Just downloaded and installed newest SDK version (22000.194.210911-1543) and guess what's missing: "Windows.winmd". – tar Mar 12 '22 at 22:20