Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GuildOfCalamity opened this issue Jun 17, 2023 · 4 comments

Comments

@GuildOfCalamity
Copy link

GuildOfCalamity commented Jun 17, 2023

I'm trying to compile some of these sample on a Win10 machine (22H2) and everyone of these sample indicates a lib reference to "Windows". Is this some SDK DLL? Where would the lib normally be found on a Windows 10 machine? Do these sample only work on Windows 8.1? I do have the Windows 8.1 SDK installed on my local machine.

  <ItemGroup>
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Data" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="System.Runtime" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Xml.Linq" />
-->  <Reference Include="Windows" />  <--
  </ItemGroup>
@oldnewthing
Copy link
Member

Please be specific which samples you are referring to. This repo contains over 1000 samples.

@GuildOfCalamity
Copy link
Author

@oldnewthing Specifically the PackageManager samples...

  • PackageManagerAddPackage
  • PackageManagerFindPackages
  • PackageManagerFindPackagesByNameAndPublisher
  • PackageManagerFindPackagesByUserSecurityId
  • PackageManagerFindPackagesWithPackageTypes
  • PackageManagerFindProvisionedPackages
  • PackageManagerRemovePackage

There may be others, but these are just the ones I have tried so far.

I am able to port the code to a new WinUI3 project where the PackageManager is part of Windows.Management.Deployment (using .NET 6), but using .NET4.5 Framework (which all the samples reference) does not seem to know where this is.

@oldnewthing
Copy link
Member

Okay, these are really old samples that were originally written for Windows 8, and it looks like things got reorganized in Windows 10. You should add references to Windows.ApplicationModel, Windows.Foundation, and Windows.Management. I'll fix the samples but that should get you unstuck.

@GuildOfCalamity
Copy link
Author

@oldnewthing Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants