The type or namespace name 'Windows' could not be found (are you missing a using directive or an assembly reference?
GuildOfCalamity opened this issue · 4 comments
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>
Please be specific which samples you are referring to. This repo contains over 1000 samples.
@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.
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.
@oldnewthing Thank you!