Skip to content

Commit ebdd7e3

Browse files
committed
Add framework-dependent and self-contained variants of CppConsoleDesktop sample
- Introduced CppConsoleDesktop.FrameworkDependent with individual package dependencies. - Added CppConsoleDesktop.SelfContained with bundled ML components for portable deployment. - Updated project files, configurations, and README documentation for both variants.
1 parent 430af55 commit ebdd7e3

File tree

11 files changed

+405
-1
lines changed

11 files changed

+405
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = crlf
5+
insert_final_newline = true
6+
7+
[*.md]
8+
indent_size = 4
9+
indent_style = space
10+
trim_trailing_whitespace = true
11+
12+
[{*.props,*.targets}]
13+
indent_size = 2
14+
indent_style = space
15+
16+
[{*.vcxproj,*.vcxproj.filters}]
17+
indent_size = 2
18+
indent_style = space
19+
insert_final_newline = false
20+
21+
[*.py]
22+
indent_size = 4
23+
indent_style = space
24+
trim_trailing_whitespace = true
25+
26+
[*.ps1]
27+
indent_size = 4
28+
indent_style = space
29+
trim_trailing_whitespace = true
30+
31+
[{*.xml,nuget.config}]
32+
indent_size = 2
33+
indent_style = space
34+
35+
[{*.h,*.cpp}]
36+
indent_size = 4
37+
indent_style = space
38+
trim_trailing_whitespace = true
39+
insert_final_newline = true
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.13.35818.85
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppConsoleDesktop.FrameworkDependent", "CppConsoleDesktop.FrameworkDependent.vcxproj", "{3341505B-863B-4DF5-9A43-B84A635D1AE9}"
6+
EndProject
7+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AEC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
8+
ProjectSection(SolutionItems) = preProject
9+
.editorconfig = .editorconfig
10+
nuget.config = nuget.config
11+
EndProjectSection
12+
EndProject
13+
Global
14+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
15+
Debug|ARM64 = Debug|ARM64
16+
Debug|x64 = Debug|x64
17+
Release|ARM64 = Release|ARM64
18+
Release|x64 = Release|x64
19+
EndGlobalSection
20+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
21+
{3341505B-863B-4DF5-9A43-B84A635D1AE9}.Debug|ARM64.ActiveCfg = Debug|ARM64
22+
{3341505B-863B-4DF5-9A43-B84A635D1AE9}.Debug|ARM64.Build.0 = Debug|ARM64
23+
{3341505B-863B-4DF5-9A43-B84A635D1AE9}.Debug|x64.ActiveCfg = Debug|x64
24+
{3341505B-863B-4DF5-9A43-B84A635D1AE9}.Debug|x64.Build.0 = Debug|x64
25+
{3341505B-863B-4DF5-9A43-B84A635D1AE9}.Release|ARM64.ActiveCfg = Release|ARM64
26+
{3341505B-863B-4DF5-9A43-B84A635D1AE9}.Release|ARM64.Build.0 = Release|ARM64
27+
{3341505B-863B-4DF5-9A43-B84A635D1AE9}.Release|x64.ActiveCfg = Release|x64
28+
{3341505B-863B-4DF5-9A43-B84A635D1AE9}.Release|x64.Build.0 = Release|x64
29+
EndGlobalSection
30+
GlobalSection(SolutionProperties) = preSolution
31+
HideSolutionNode = FALSE
32+
EndGlobalSection
33+
GlobalSection(ExtensibilityGlobals) = postSolution
34+
SolutionGuid = {D26F183B-119C-4A29-870E-285D98F093F1}
35+
EndGlobalSection
36+
EndGlobal
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="packages\Microsoft.WindowsAppSDK.Runtime.1.8.250702007-experimental4\build\native\Microsoft.WindowsAppSDK.Runtime.props" Condition="Exists('packages\Microsoft.WindowsAppSDK.Runtime.1.8.250702007-experimental4\build\native\Microsoft.WindowsAppSDK.Runtime.props')" />
4+
<Import Project="packages\Microsoft.WindowsAppSDK.Base.1.8.250509001-experimental\build\native\Microsoft.WindowsAppSDK.Base.props" Condition="Exists('packages\Microsoft.WindowsAppSDK.Base.1.8.250509001-experimental\build\native\Microsoft.WindowsAppSDK.Base.props')" />
5+
<Import Project="packages\Microsoft.Windows.SDK.BuildTools.MSIX.1.7.20250508.1\build\Microsoft.Windows.SDK.BuildTools.MSIX.props" Condition="Exists('packages\Microsoft.Windows.SDK.BuildTools.MSIX.1.7.20250508.1\build\Microsoft.Windows.SDK.BuildTools.MSIX.props')" />
6+
<Import Project="packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.3233\build\Microsoft.Windows.SDK.BuildTools.props" Condition="Exists('packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.3233\build\Microsoft.Windows.SDK.BuildTools.props')" />
7+
<Import Project="packages\Microsoft.WindowsAppSDK.ML.1.8.1054-preview-g4c0c9eea59\build\native\Microsoft.WindowsAppSDK.ML.props" Condition="Exists('packages\Microsoft.WindowsAppSDK.ML.1.8.1054-preview-g4c0c9eea59\build\native\Microsoft.WindowsAppSDK.ML.props')" />
8+
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.240915.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.240915.1\build\native\Microsoft.Windows.CppWinRT.props')" />
9+
<ItemGroup Label="ProjectConfigurations">
10+
<ProjectConfiguration Include="Debug|x64" Configuration="Debug" Platform="x64" />
11+
<ProjectConfiguration Include="Release|x64" Configuration="Release" Platform="x64" />
12+
<ProjectConfiguration Include="Debug|ARM64" Configuration="Debug" Platform="ARM64" />
13+
<ProjectConfiguration Include="Release|ARM64" Configuration="Release" Platform="ARM64" />
14+
</ItemGroup>
15+
<PropertyGroup Label="Globals">
16+
<VCProjectVersion>17.0</VCProjectVersion>
17+
<Keyword>Win32Proj</Keyword>
18+
<ProjectGuid>{3341505b-863b-4df5-9a43-b84a635d1ae9}</ProjectGuid>
19+
<RootNamespace>CppConsoleDesktopFrameworkDependent</RootNamespace>
20+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
21+
<WindowsPackageType>None</WindowsPackageType>
22+
<DefaultLanguage>en-US</DefaultLanguage>
23+
<!-- Framework-dependent deployment (default) -->
24+
<WindowsAppSDKSelfContained>false</WindowsAppSDKSelfContained>
25+
</PropertyGroup>
26+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
27+
<PropertyGroup Label="Configuration">
28+
<ConfigurationType>Application</ConfigurationType>
29+
<PlatformToolset>v143</PlatformToolset>
30+
<CharacterSet>Unicode</CharacterSet>
31+
</PropertyGroup>
32+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
33+
<ItemDefinitionGroup>
34+
<ClCompile>
35+
<LanguageStandard>stdcpp20</LanguageStandard>
36+
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
37+
<TreatWarningAsError>true</TreatWarningAsError>
38+
<WarningLevel>Level4</WarningLevel>
39+
</ClCompile>
40+
<Link>
41+
<SubSystem>Console</SubSystem>
42+
</Link>
43+
</ItemDefinitionGroup>
44+
<ItemGroup>
45+
<ClCompile Include="..\CppConsoleDesktop\CppConsoleDesktop\CppConsoleDesktop.cpp" />
46+
</ItemGroup>
47+
<ItemGroup>
48+
<None Include="packages.config" />
49+
<Content Include="..\CppConsoleDesktop\CppConsoleDesktop\SqueezeNet.onnx" CopyToOutputDirectory="PreserveNewest" />
50+
<Content Include="..\CppConsoleDesktop\CppConsoleDesktop\SqueezeNet.Labels.txt" CopyToOutputDirectory="PreserveNewest" />
51+
<!-- Image source : https://brandcentral.microsoft.com/asset-detail.html?id=L2NvbnRlbnQvZGFtL3NvdXJjZS9taWNyb3NvZnQtcHJvZHVjdHMtc2VydmljZXMvYXp1cmUvcGhvdG9ncmFwaHkvMjAxNy9DTE8xN19henVyZV8wMTY%3D&searchType=simple&fuzzyTerm= -->
52+
<Content Include="..\CppConsoleDesktop\CppConsoleDesktop\image.jpg" CopyToOutputDirectory="PreserveNewest" />
53+
</ItemGroup>
54+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
55+
<ImportGroup Label="ExtensionTargets">
56+
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.240915.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.240915.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
57+
<Import Project="packages\Microsoft.WindowsAppSDK.ML.1.8.1054-preview-g4c0c9eea59\build\native\Microsoft.WindowsAppSDK.ML.targets" Condition="Exists('packages\Microsoft.WindowsAppSDK.ML.1.8.1054-preview-g4c0c9eea59\build\native\Microsoft.WindowsAppSDK.ML.targets')" />
58+
<Import Project="packages\Microsoft.WindowsAppSDK.Runtime.1.8.250702007-experimental4\build\native\Microsoft.WindowsAppSDK.Runtime.targets" Condition="Exists('packages\Microsoft.WindowsAppSDK.Runtime.1.8.250702007-experimental4\build\native\Microsoft.WindowsAppSDK.Runtime.targets')" />
59+
<Import Project="packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.3233\build\Microsoft.Windows.SDK.BuildTools.targets" Condition="Exists('packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.3233\build\Microsoft.Windows.SDK.BuildTools.targets')" />
60+
<Import Project="packages\Microsoft.Windows.SDK.BuildTools.MSIX.1.7.20250508.1\build\Microsoft.Windows.SDK.BuildTools.MSIX.targets" Condition="Exists('packages\Microsoft.Windows.SDK.BuildTools.MSIX.1.7.20250508.1\build\Microsoft.Windows.SDK.BuildTools.MSIX.targets')" />
61+
<Import Project="packages\Microsoft.WindowsAppSDK.Base.1.8.250509001-experimental\build\native\Microsoft.WindowsAppSDK.Base.targets" Condition="Exists('packages\Microsoft.WindowsAppSDK.Base.1.8.250509001-experimental\build\native\Microsoft.WindowsAppSDK.Base.targets')" />
62+
</ImportGroup>
63+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
64+
<PropertyGroup>
65+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
66+
</PropertyGroup>
67+
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.240915.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.240915.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
68+
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.240915.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.240915.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
69+
<Error Condition="!Exists('packages\Microsoft.WindowsAppSDK.ML.1.8.1054-preview-g4c0c9eea59\build\native\Microsoft.WindowsAppSDK.ML.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.WindowsAppSDK.ML.1.8.1054-preview-g4c0c9eea59\build\native\Microsoft.WindowsAppSDK.ML.props'))" />
70+
<Error Condition="!Exists('packages\Microsoft.WindowsAppSDK.ML.1.8.1054-preview-g4c0c9eea59\build\native\Microsoft.WindowsAppSDK.ML.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.WindowsAppSDK.ML.1.8.1054-preview-g4c0c9eea59\build\native\Microsoft.WindowsAppSDK.ML.targets'))" />
71+
<Error Condition="!Exists('packages\Microsoft.WindowsAppSDK.Runtime.1.8.250702007-experimental4\build\native\Microsoft.WindowsAppSDK.Runtime.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.WindowsAppSDK.Runtime.1.8.250702007-experimental4\build\native\Microsoft.WindowsAppSDK.Runtime.props'))" />
72+
<Error Condition="!Exists('packages\Microsoft.WindowsAppSDK.Runtime.1.8.250702007-experimental4\build\native\Microsoft.WindowsAppSDK.Runtime.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.WindowsAppSDK.Runtime.1.8.250702007-experimental4\build\native\Microsoft.WindowsAppSDK.Runtime.targets'))" />
73+
<Error Condition="!Exists('packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.3233\build\Microsoft.Windows.SDK.BuildTools.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.3233\build\Microsoft.Windows.SDK.BuildTools.props'))" />
74+
<Error Condition="!Exists('packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.3233\build\Microsoft.Windows.SDK.BuildTools.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.3233\build\Microsoft.Windows.SDK.BuildTools.targets'))" />
75+
<Error Condition="!Exists('packages\Microsoft.Windows.SDK.BuildTools.MSIX.1.7.20250508.1\build\Microsoft.Windows.SDK.BuildTools.MSIX.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.SDK.BuildTools.MSIX.1.7.20250508.1\build\Microsoft.Windows.SDK.BuildTools.MSIX.props'))" />
76+
<Error Condition="!Exists('packages\Microsoft.Windows.SDK.BuildTools.MSIX.1.7.20250508.1\build\Microsoft.Windows.SDK.BuildTools.MSIX.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.SDK.BuildTools.MSIX.1.7.20250508.1\build\Microsoft.Windows.SDK.BuildTools.MSIX.targets'))" />
77+
<Error Condition="!Exists('packages\Microsoft.WindowsAppSDK.Base.1.8.250509001-experimental\build\native\Microsoft.WindowsAppSDK.Base.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.WindowsAppSDK.Base.1.8.250509001-experimental\build\native\Microsoft.WindowsAppSDK.Base.props'))" />
78+
<Error Condition="!Exists('packages\Microsoft.WindowsAppSDK.Base.1.8.250509001-experimental\build\native\Microsoft.WindowsAppSDK.Base.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.WindowsAppSDK.Base.1.8.250509001-experimental\build\native\Microsoft.WindowsAppSDK.Base.targets'))" />
79+
</Target>
80+
</Project>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# CppConsoleDesktop.FrameworkDependent
2+
3+
This is a framework-dependent variant of the WindowsML C++ console desktop sample.
4+
5+
## Key Differences from Original
6+
7+
- **Deployment**: Framework-dependent (`WindowsAppSDKSelfContained=false`)
8+
- **Package Dependencies**: Uses both ML and Runtime packages for framework-dependent deployment
9+
- **Source Files**: References the same source files from `../CppConsoleDesktop/CppConsoleDesktop/`
10+
- **Runtime Dependencies**: Requires WindowsAppSDK Runtime to be installed on target machine
11+
12+
## Features
13+
14+
- Framework-dependent deployment with smaller application footprint
15+
- Relies on WindowsAppSDK Runtime package installed on target machine
16+
- Shared runtime components reduce deployment size
17+
- Follows the recommended deployment pattern for WindowsAppSDK applications
18+
19+
## Build
20+
21+
```powershell
22+
# Restore packages first
23+
nuget restore packages.config -PackagesDirectory packages
24+
25+
# Build the project
26+
msbuild CppConsoleDesktop.FrameworkDependent.vcxproj /p:Platform=x64 /p:Configuration=Release
27+
```
28+
29+
> **Note**: If you encounter package restore issues in Visual Studio, use the command-line `nuget restore` as shown above.
30+
31+
## Package Dependencies
32+
33+
- WindowsAppSDK ML package (core machine learning functionality)
34+
- WindowsAppSDK Runtime package (framework runtime components)
35+
- WindowsAppSDK Base package (required for proper binary deployment)
36+
- CppWinRT package (Windows Runtime projections)
37+
- Windows SDK Build Tools packages (build-time dependencies)
38+
39+
See `packages.config` for current package versions.
40+
41+
## Deployment Requirements
42+
43+
The target machine must have the Windows App SDK Runtime installed. This is the recommended deployment model for most applications as it allows for shared runtime components and easier servicing.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Microsoft.Windows.CppWinRT" version="2.0.240915.1" targetFramework="native" />
4+
<package id="Microsoft.Windows.SDK.BuildTools" version="10.0.22621.3233" targetFramework="native" />
5+
<package id="Microsoft.Windows.SDK.BuildTools.MSIX" version="1.7.20250508.1" targetFramework="native" developmentDependency="true" />
6+
<package id="Microsoft.WindowsAppSDK.Base" version="1.8.250509001-experimental" targetFramework="native" />
7+
<package id="Microsoft.WindowsAppSDK.ML" version="1.8.1054-preview-g4c0c9eea59" targetFramework="native" />
8+
<package id="Microsoft.WindowsAppSDK.Runtime" version="1.8.250702007-experimental4" targetFramework="native" />
9+
</packages>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = crlf
5+
insert_final_newline = true
6+
7+
[*.md]
8+
indent_size = 4
9+
indent_style = space
10+
trim_trailing_whitespace = true
11+
12+
[{*.props,*.targets}]
13+
indent_size = 2
14+
indent_style = space
15+
16+
[{*.vcxproj,*.vcxproj.filters}]
17+
indent_size = 2
18+
indent_style = space
19+
insert_final_newline = false
20+
21+
[*.py]
22+
indent_size = 4
23+
indent_style = space
24+
trim_trailing_whitespace = true
25+
26+
[*.ps1]
27+
indent_size = 4
28+
indent_style = space
29+
trim_trailing_whitespace = true
30+
31+
[{*.xml,nuget.config}]
32+
indent_size = 2
33+
indent_style = space
34+
35+
[{*.h,*.cpp}]
36+
indent_size = 4
37+
indent_style = space
38+
trim_trailing_whitespace = true
39+
insert_final_newline = true
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.13.35818.85
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppConsoleDesktop.SelfContained", "CppConsoleDesktop.SelfContained.vcxproj", "{2341505B-863B-4DF5-9A43-B84A635D1AE9}"
6+
EndProject
7+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
8+
ProjectSection(SolutionItems) = preProject
9+
.editorconfig = .editorconfig
10+
nuget.config = nuget.config
11+
EndProjectSection
12+
EndProject
13+
Global
14+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
15+
Debug|ARM64 = Debug|ARM64
16+
Debug|x64 = Debug|x64
17+
Release|ARM64 = Release|ARM64
18+
Release|x64 = Release|x64
19+
EndGlobalSection
20+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
21+
{2341505B-863B-4DF5-9A43-B84A635D1AE9}.Debug|ARM64.ActiveCfg = Debug|ARM64
22+
{2341505B-863B-4DF5-9A43-B84A635D1AE9}.Debug|ARM64.Build.0 = Debug|ARM64
23+
{2341505B-863B-4DF5-9A43-B84A635D1AE9}.Debug|x64.ActiveCfg = Debug|x64
24+
{2341505B-863B-4DF5-9A43-B84A635D1AE9}.Debug|x64.Build.0 = Debug|x64
25+
{2341505B-863B-4DF5-9A43-B84A635D1AE9}.Release|ARM64.ActiveCfg = Release|ARM64
26+
{2341505B-863B-4DF5-9A43-B84A635D1AE9}.Release|ARM64.Build.0 = Release|ARM64
27+
{2341505B-863B-4DF5-9A43-B84A635D1AE9}.Release|x64.ActiveCfg = Release|x64
28+
{2341505B-863B-4DF5-9A43-B84A635D1AE9}.Release|x64.Build.0 = Release|x64
29+
EndGlobalSection
30+
GlobalSection(SolutionProperties) = preSolution
31+
HideSolutionNode = FALSE
32+
EndGlobalSection
33+
GlobalSection(ExtensibilityGlobals) = postSolution
34+
SolutionGuid = {C26F183B-119C-4A29-870E-285D98F093F1}
35+
EndGlobalSection
36+
EndGlobal

0 commit comments

Comments
 (0)