The type ‘System.IDisposable’ is defined in an assembly that is not referenced

If you are targeting Windows 8, the MSDN documentation has the following instructions:

That said, your desktop app can’t consume much of anything from the
Windows Runtime until you prepare your project with one essential
reference. The Windows Runtime defines some standard classes and
interfaces in System.Runtime, such as IEnumerable, that are used
throughout the Windows Runtime libraries. By default, your managed
desktop app won’t be able to find these types, and so you must
manually reference System.Runtime before you can do anything
meaningful with Windows Runtime classes. To create this manual
reference:

  1. Navigate to your managed desktop app project in the Solution Explorer.
  2. Right-click the References node and click Add Reference.
  3. Click the Browse tab.
  4. Click Browse….
  5. Navigate to the System.Runtime.dll façade. You can generally find this in a path similar to: %ProgramFiles(x86)%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Runtime.dll

Hope that helps.

Leave a Comment