Skip to content

Commit

Permalink
Use Embedded C#/WinRT Support (#451)
Browse files Browse the repository at this point in the history
* Use Embedded C#/WinRT Support

* Update build.yml
  • Loading branch information
Kinnara authored May 29, 2022
1 parent 48167bf commit 4045a73
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 64 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Setup Windows SDK
uses: GuillaumeFalourd/[email protected]
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
8 changes: 8 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<PropertyGroup>
<Version>0.9.4</Version>
<Authors>Yimeng Wu</Authors>
<Product>ModernWPF UI Library</Product>
<LangVersion>9.0</LangVersion>
</PropertyGroup>
</Project>
39 changes: 0 additions & 39 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<Project>
<PropertyGroup>
<Version>0.9.4</Version>
<Authors>Yimeng Wu</Authors>
<Product>ModernWPF UI Library</Product>
</PropertyGroup>

<PropertyGroup Condition="'$(PackageId)' != ''">
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Kinnara/ModernWpf</PackageProjectUrl>
Expand Down Expand Up @@ -39,37 +33,4 @@
<PropertyGroup Condition="'$(SupportedOSPlatform)' != '' and $([MSBuild]::VersionGreaterThan($(SupportedOSPlatform), '7.0'))">
<SupportedOSPlatform>7.0</SupportedOSPlatform>
</PropertyGroup>

<Choose>
<When Condition="'$(UseWinRT)' == 'true'">
<Choose>
<When Condition="$(DefineConstants.Contains('NET5_0_OR_NEWER'))" />
<When Condition="$(DefineConstants.Contains('NET461_OR_NEWER'))">
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.18362.2005" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<PackageReference Include="System.Runtime.WindowsRuntime" Version="4.6.0" />
<Reference Include="Windows">
<HintPath>$(MSBuildThisFileDirectory)WinMD\Windows.WinMD</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
</Reference>
<Reference Include="Windows.Foundation.FoundationContract">
<HintPath>$(MSBuildThisFileDirectory)WinMD\Windows.Foundation.FoundationContract.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
</Reference>
<Reference Include="Windows.Foundation.UniversalApiContract">
<HintPath>$(MSBuildThisFileDirectory)WinMD\Windows.Foundation.UniversalApiContract.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
</Reference>
</ItemGroup>
</Otherwise>
</Choose>
</When>
</Choose>
</Project>
3 changes: 1 addition & 2 deletions ModernWpf.Controls/ModernWpf.Controls.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<TargetFrameworks>net45;net462;netcoreapp3.0;net5.0-windows10.0.18362.0</TargetFrameworks>
<TargetFrameworks>net45;net462;netcoreapp3.0;net5.0-windows7.0</TargetFrameworks>
<UseWPF>true</UseWPF>
<NeutralLanguage>en-US</NeutralLanguage>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);GetDocumentationFile</TargetsForTfmSpecificBuildOutput>
<NuspecFile>$(MSBuildThisFileDirectory)ModernWpfUI.nuspec</NuspecFile>
<PackageId>ModernWpfUI</PackageId>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions ModernWpf.Controls/ModernWpfUI.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
<group targetFramework="netcoreapp3.0">
<dependency id="Microsoft.Windows.SDK.Contracts" version="10.0.18362.2005" exclude="Build,Analyzers" />
</group>
<group targetFramework="net5.0-windows10.0.18362" />
<group targetFramework="net5.0-windows7.0" />
</dependencies>
<frameworkReferences>
<group targetFramework="netcoreapp3.0">
<frameworkReference name="Microsoft.WindowsDesktop.App.WPF" />
</group>
<group targetFramework="net5.0-windows10.0.18362">
<group targetFramework="net5.0-windows7.0">
<frameworkReference name="Microsoft.WindowsDesktop.App.WPF" />
</group>
</frameworkReferences>
Expand Down
2 changes: 1 addition & 1 deletion ModernWpf.MahApps/ModernWpf.MahApps.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<TargetFrameworks>net452;net46;net462;net47;netcoreapp3.0;netcoreapp3.1;net5.0-windows10.0.18362.0</TargetFrameworks>
<TargetFrameworks>net452;net46;net462;net47;netcoreapp3.0;netcoreapp3.1;net5.0-windows7.0</TargetFrameworks>
<UseWPF>true</UseWPF>
<NeutralLanguage>en-US</NeutralLanguage>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
3 changes: 1 addition & 2 deletions ModernWpf.SampleApp/ModernWpf.SampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net45;net48;netcoreapp3.1;net5.0-windows10.0.18362.0</TargetFrameworks>
<TargetFrameworks>net45;net48;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<ApplicationIcon>Assets\AppIcon.ico</ApplicationIcon>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
Expand Down
15 changes: 8 additions & 7 deletions ModernWpf.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29215.179
# Visual Studio Version 17
VisualStudioVersion = 17.2.32519.379
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModernWpf.SampleApp", "ModernWpf.SampleApp\ModernWpf.SampleApp.csproj", "{4AB31DB2-4024-49E6-A522-F5418371A264}"
EndProject
Expand All @@ -11,6 +11,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModernWpf.Controls", "Moder
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1387DCAB-42A4-4F47-9E85-16998E2D9C71}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
Settings.XamlStyler = Settings.XamlStyler
EndProjectSection
Expand Down Expand Up @@ -45,13 +46,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultiThreadingSample", "sam
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{07337569-6CA9-4BB0-9C8F-962D981CB5F4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinUIResourcesConverter", "tools\WinUIResourcesConverter\WinUIResourcesConverter.csproj", "{35EF6F6B-3E8C-4A9E-BCD2-16CA5C2C2ADC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinUIResourcesConverter", "tools\WinUIResourcesConverter\WinUIResourcesConverter.csproj", "{35EF6F6B-3E8C-4A9E-BCD2-16CA5C2C2ADC}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
test\NavigationView_TestUI\NavigationView_TestUI.projitems*{02ca89c3-68d7-4c80-9278-9a0f53fbe199}*SharedItemsImports = 13
test\NavigationView_TestUI\NavigationView_TestUI.projitems*{bb64399b-330b-45ba-be71-5ffa6ce841a8}*SharedItemsImports = 5
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Expand Down Expand Up @@ -386,4 +383,8 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6251E140-0FAA-4DE9-B245-1C5BE188E578}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
test\NavigationView_TestUI\NavigationView_TestUI.projitems*{02ca89c3-68d7-4c80-9278-9a0f53fbe199}*SharedItemsImports = 13
test\NavigationView_TestUI\NavigationView_TestUI.projitems*{bb64399b-330b-45ba-be71-5ffa6ce841a8}*SharedItemsImports = 5
EndGlobalSection
EndGlobal
51 changes: 48 additions & 3 deletions ModernWpf/ModernWpf.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,59 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<TargetFrameworks>net45;net462;netcoreapp3.0;net5.0-windows10.0.18362.0</TargetFrameworks>
<TargetFrameworks>net45;net462;netcoreapp3.0;net5.0-windows7.0</TargetFrameworks>
<UseWPF>true</UseWPF>
<NeutralLanguage>en-US</NeutralLanguage>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>latest</LangVersion>
<UseWinRT>true</UseWinRT>
</PropertyGroup>

<PropertyGroup>
<CsWinRTEmbedded>true</CsWinRTEmbedded>
<CsWinRTWindowsMetadata>10.0.18362.0</CsWinRTWindowsMetadata>
<CsWinRTIncludes>
Windows.Foundation;
Windows.UI.Color;
Windows.UI.IColors;
Windows.UI.ViewManagement.HandPreference;
Windows.UI.ViewManagement.IUISettings;
Windows.UI.ViewManagement.UIColorType;
Windows.UI.ViewManagement.UIElementType;
Windows.UI.ViewManagement.UISettings;
</CsWinRTIncludes>
<CsWinRTExcludes>
Windows.Foundation.Diagnostics;
Windows.Foundation.PropertyType;
</CsWinRTExcludes>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '5.0'))">
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="1.6.4" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '3.0')) and $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '5.0')) or
'$(TargetFrameworkIdentifier)' == '.NETFramework' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '4.6.1'))">
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.18362.2005" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '4.6.1'))">
<PackageReference Include="System.Runtime.WindowsRuntime" Version="4.6.0" />
<Reference Include="Windows">
<HintPath>$(SolutionDir)WinMD\Windows.WinMD</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
</Reference>
<Reference Include="Windows.Foundation.FoundationContract">
<HintPath>$(SolutionDir)WinMD\Windows.Foundation.FoundationContract.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
</Reference>
<Reference Include="Windows.Foundation.UniversalApiContract">
<HintPath>$(SolutionDir)WinMD\Windows.Foundation.UniversalApiContract.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
</Reference>
</ItemGroup>

<ItemGroup Condition="!$(DefineConstants.Contains('NET47_OR_NEWER'))">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions samples/MahAppsSample/MahAppsSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net48;netcoreapp3.1;net5.0-windows10.0.18362.0</TargetFrameworks>
<TargetFrameworks>net48;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<ApplicationManifest>app.manifest</ApplicationManifest>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/SamplesCommon/SamplesCommon.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<TargetFrameworks>net45;net462;netcoreapp3.1;net5.0-windows10.0.18362.0</TargetFrameworks>
<TargetFrameworks>net45;net462;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
</PropertyGroup>

Expand Down
1 change: 0 additions & 1 deletion test/ModernWpfTestApp/ModernWpfTestApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<UseWPF>true</UseWPF>
<AssemblyName>MUXControlsTestApp</AssemblyName>
<RootNamespace>MUXControlsTestApp</RootNamespace>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion test/TestAppUtils/TestAppUtils.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<UseWPF>true</UseWPF>
<LangVersion>8.0</LangVersion>
<RootNamespace>System.Windows</RootNamespace>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<TargetFramework>net48</TargetFramework>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 4045a73

Please sign in to comment.