user9413194
user9413194

Reputation: 119

Error CS0246 The type or namespace name 'Windows' could not be found (are you missing a using directive or an assembly reference?)

I want to run the Xamarin project and did all the updates. When I run the project I get the following error

The type or namespace name 'Windows' could not be found (are you missing a using directive or an assembly reference?)

for the lines

using Windows.Storage; 
using Windows.ApplicationModel.ExtendedExecution;

Upvotes: 4

Views: 13953

Answers (2)

Thierry Brémard
Thierry Brémard

Reputation: 899

Not on Xamarin but on net framework 4.8:

ensure you have ref to System.Windows ..... but also to Presentation framework! nice joke @microsoft!

<Reference Include="PresentationFramework" />
<Reference Include="System.Windows" />

Upvotes: 0

Jessie Zhang -MSFT
Jessie Zhang -MSFT

Reputation: 13813

That's because you're missing these .dll

The recommended steps to get access to UWP APIs are listed in the dedicated blog post on Windows Blog. Basically you can take two approaches: add the references to UWP dlls and winmd files manually or use the UwpDesktop NuGet package that will take care of this for you automatically.

For more details, you can check: How do I get access to Windows.Storage namespace?

Upvotes: 4

Related Questions