title: Visual Studio 2019 - Could not locate the assembly "Windows"
body: <p>I'm trying to use <a href="https://github.com/rkeithhill/PoshWinRT" rel="nofollow noreferrer">this PoshWinRT .NET/Powershell library</a>, as described in <a href="https://rkeithhill.wordpress.com/2013/09/30/calling-winrt-async-methods-from-windows-powershell/" rel="nofollow noreferrer">this blog post</a>, and <a href="https://stackoverflow.com/questions/21194315/call-winrt-async-method-from-powershell-to-set-account-picture-in-win8">this SO question</a>. This worked for me before on Windows 7, but now I am on Windows 10 and since I've moved to a new computer I've cleared the assemblies cached during the build.</p>
  <p>The code uses several classes such as Windows.Foundation.IAsyncAction, which are failing because of a missing &quot;Windows&quot; assembly:</p>
  <blockquote>
  <p>CS0012    The type 'IAsyncAction' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.    PoshWinRT   D:\projects\PoshWinRT\PoshWinRT\AsyncActionWrapper.cs   21</p>
  </blockquote>
  <p>As well as an error about that assembly:</p>
  <blockquote>
  <p>Could not resolve this reference. Could not locate the assembly &quot;Windows&quot;. Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.</p>
  </blockquote>
  <p>In the right-hand Solution Explorer, the following properties are shown for the &quot;Windows&quot; dependency in my References list:</p>
  <p><a href="https://i.stack.imgur.com/zF1VF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zF1VF.png" alt="enter image description here" /></a></p>
  <p>The above <code>.winmd</code> has been deleted, but now I'm not sure how to re-add it. I've tried adding things like:</p>
  <pre><code>System.Windows
  Windows.Foundation
  Windows.Storage
  Windows.System
  </code></pre>
  <p>But without any luck. How do I re-add the &quot;Windows&quot; assembly? I am guessing that either classes have moved around since I last used this code or maybe this is a wrapper for native code that needs to be included in some special way. Or maybe I don't have the right library installed. I've installed the VS WinRT extension, but that didn't help.</p>
  <p>I should say that I'm hoping to import this in pwsh (core), where before it was running in pre-core powershell.</p>