Skip to content

Commit 8c29ea6

Browse files
authored
Add right permissions to the app after new security enforcements (#483)
After new security enforcements are in, every app using Windows AI apis need these configs in their manifest files and solution files. For details read here : learn.microsoft.com/en-us/windows/ai/apis/get-started?tabs=winget%2Cwinui%2Cwinui2 Also convert tabs to spaces for these files.
1 parent 4d1f233 commit 8c29ea6

File tree

2 files changed

+74
-70
lines changed

2 files changed

+74
-70
lines changed

Samples/WindowsAIFoundry/cs-winui/Package.appxmanifest

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,47 @@
44
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
55
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
66
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
7-
IgnorableNamespaces="uap rescap">
7+
xmlns:systemai="http://schemas.microsoft.com/appx/manifest/systemai/windows10"
8+
IgnorableNamespaces="uap rescap systemai">
89

9-
<Identity
10-
Name="83A5CFAE-CB0B-4A04-978E-F8A251F3AED2"
11-
Publisher="CN=microsoft"
12-
Version="1.0.0.0" />
10+
<Identity
11+
Name="83A5CFAE-CB0B-4A04-978E-F8A251F3AED2"
12+
Publisher="CN=microsoft"
13+
Version="1.0.0.0" />
1314

14-
<Properties>
15-
<DisplayName>Windows AI Samples</DisplayName>
16-
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
17-
<Logo>Assets\StoreLogo.png</Logo>
18-
</Properties>
15+
<Properties>
16+
<DisplayName>Windows AI Samples</DisplayName>
17+
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
18+
<Logo>Assets\StoreLogo.png</Logo>
19+
</Properties>
1920

20-
<Dependencies>
21-
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
22-
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
23-
</Dependencies>
21+
<Dependencies>
22+
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26226.0" />
23+
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26226.0" />
24+
</Dependencies>
2425

25-
<Resources>
26-
<Resource Language="x-generate"/>
27-
</Resources>
26+
<Resources>
27+
<Resource Language="x-generate"/>
28+
</Resources>
2829

29-
<Applications>
30-
<Application Id="App"
31-
Executable="$targetnametoken$.exe"
32-
EntryPoint="$targetentrypoint$">
33-
<uap:VisualElements
34-
DisplayName="Windows AI Samples"
35-
Description="This sample app showcases the AI capabilities provided by the Windows AI Samples."
36-
BackgroundColor="transparent"
37-
Square150x150Logo="Assets\Square150x150Logo.png"
38-
Square44x44Logo="Assets\Square44x44Logo.png">
39-
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
40-
<uap:SplashScreen Image="Assets\SplashScreen.png" />
41-
</uap:VisualElements>
42-
</Application>
43-
</Applications>
30+
<Applications>
31+
<Application Id="App"
32+
Executable="$targetnametoken$.exe"
33+
EntryPoint="$targetentrypoint$">
34+
<uap:VisualElements
35+
DisplayName="Windows AI Samples"
36+
Description="This sample app showcases the AI capabilities provided by the Windows AI Samples."
37+
BackgroundColor="transparent"
38+
Square150x150Logo="Assets\Square150x150Logo.png"
39+
Square44x44Logo="Assets\Square44x44Logo.png">
40+
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
41+
<uap:SplashScreen Image="Assets\SplashScreen.png" />
42+
</uap:VisualElements>
43+
</Application>
44+
</Applications>
4445

45-
<Capabilities>
46-
<rescap:Capability Name="runFullTrust" />
47-
</Capabilities>
46+
<Capabilities>
47+
<rescap:Capability Name="runFullTrust" />
48+
<systemai:Capability Name="systemAIModels"/>
49+
</Capabilities>
4850
</Package>

Samples/WindowsAIFoundry/cs-winui/WindowsAISample.csproj

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@
1010
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
1111
<UseWinUI>true</UseWinUI>
1212
<EnableMsixTooling>true</EnableMsixTooling>
13-
<Nullable>enable</Nullable>
14-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
15-
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
16-
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
17-
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
18-
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
19-
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
20-
<GenerateTestArtifacts>True</GenerateTestArtifacts>
21-
<AppxBundle>Never</AppxBundle>
22-
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
23-
</PropertyGroup>
13+
<Nullable>enable</Nullable>
14+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
15+
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
16+
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
17+
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
18+
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
19+
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
20+
<GenerateTestArtifacts>True</GenerateTestArtifacts>
21+
<AppxBundle>Never</AppxBundle>
22+
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
23+
<AppxOSMinVersionReplaceManifestVersion>false</AppxOSMinVersionReplaceManifestVersion>
24+
<AppxOSMaxVersionTestedReplaceManifestVersion>false</AppxOSMaxVersionTestedReplaceManifestVersion>
25+
</PropertyGroup>
2426
<ItemGroup>
2527
<None Remove="Controls\ModelInitializationControl.xaml" />
2628
<None Remove="Examples\ImageObjectExtractor.md" />
@@ -38,21 +40,21 @@
3840
</ItemGroup>
3941

4042
<ItemGroup>
41-
<Content Include="Assets\*.jpg">
42-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
43-
</Content>
44-
<Content Include="Assets\*.png">
45-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
46-
</Content>
47-
<Content Include="Examples\*.md">
43+
<Content Include="Assets\*.jpg">
44+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
45+
</Content>
46+
<Content Include="Assets\*.png">
47+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
48+
</Content>
49+
<Content Include="Examples\*.md">
4850
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4951
</Content>
5052
</ItemGroup>
5153

5254
<ItemGroup>
5355
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.3.1" />
54-
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
55-
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250513003" />
56+
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
57+
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250513003" />
5658
<Manifest Include="$(ApplicationManifest)" />
5759
</ItemGroup>
5860

@@ -92,19 +94,19 @@
9294
<Generator>MSBuild:Compile</Generator>
9395
</Page>
9496
</ItemGroup>
95-
<ItemGroup>
96-
<Page Update="Pages\LanguageModelPage.xaml">
97-
<Generator>MSBuild:Compile</Generator>
98-
</Page>
99-
</ItemGroup>
100-
<ItemGroup>
101-
<Page Update="Pages\TextRecognizerPage.xaml">
102-
<Generator>MSBuild:Compile</Generator>
103-
</Page>
104-
</ItemGroup>
105-
<ItemGroup>
106-
<Page Update="Controls\ModelInitializationControl.xaml">
107-
<Generator>MSBuild:Compile</Generator>
108-
</Page>
109-
</ItemGroup>
97+
<ItemGroup>
98+
<Page Update="Pages\LanguageModelPage.xaml">
99+
<Generator>MSBuild:Compile</Generator>
100+
</Page>
101+
</ItemGroup>
102+
<ItemGroup>
103+
<Page Update="Pages\TextRecognizerPage.xaml">
104+
<Generator>MSBuild:Compile</Generator>
105+
</Page>
106+
</ItemGroup>
107+
<ItemGroup>
108+
<Page Update="Controls\ModelInitializationControl.xaml">
109+
<Generator>MSBuild:Compile</Generator>
110+
</Page>
111+
</ItemGroup>
110112
</Project>

0 commit comments

Comments
 (0)