Skip to content

Commit

Permalink
Fix build issues in UWP projects
Browse files Browse the repository at this point in the history
Use "MSBuild.NET.Extras.Sdk" instead of "MSBuild.Sdk.Extras" for projects.
This replacement package contains fixes around UWP project setup and build!
  • Loading branch information
Nirmal4G committed Oct 27, 2022
1 parent 4b8a67d commit 9a6802c
Show file tree
Hide file tree
Showing 50 changed files with 139 additions and 144 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
<PropertyGroup>
<!-- Code CS8002 is a warning for strong named -> non-strong-named reference. This is valid for platforms other than .NET Framework (and is needed for the UWP targets. -->
<NoWarn>$(NoWarn);CS8002</NoWarn>
<!-- For including default @(Page) and @(Resource) items via 'MSBuild.Sdk.Extras' Sdk package. Also provides up to date check and file nesting -->
<ExtrasEnableDefaultXamlItems>true</ExtrasEnableDefaultXamlItems>
<!-- For including default @(Page) and @(Resource) items via 'MSBuild.NET.Extras.Sdk' Sdk package. Also provides up to date check and file nesting -->
<EnableDefaultXamlItems>true</EnableDefaultXamlItems>
</PropertyGroup>
</When>
</Choose>
Expand Down
5 changes: 2 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup Label="Core">
<NETStandardImplicitPackageVersion>2.0.3</NETStandardImplicitPackageVersion>
<ExtrasUwpMetaPackageVersion>6.2.13</ExtrasUwpMetaPackageVersion>
</PropertyGroup>

<ItemGroup Label="Core">
Expand All @@ -12,8 +11,8 @@
<PackageVersion Include="Microsoft.UI.Xaml" Version="2.7.1" />
<PackageVersion Include="Microsoft.Xaml.Behaviors.Uwp.Managed" Version="2.0.1" />
<PackageVersion Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
<!-- MSBuild SDK Extras refernces the following package implicitly -->
<PackageVersion Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.13" Condition="'$(_SdkShortFrameworkIdentifier)' != 'uap'" />
<!-- MSBuild .NET Extras SDK refernces the following package implicitly -->
<PackageVersion Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.13" Condition="'$(UsingMSBuildNETExtrasSdk)' != 'true'" />
<!-- C# Compiler SDK -->
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
Expand Down
16 changes: 8 additions & 8 deletions GazeInputTest/GazeInputTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
Expand All @@ -40,15 +40,15 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
Expand All @@ -59,15 +59,15 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
<DebugSymbols>true</DebugSymbols>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>ARM64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM64</PlatformTarget>
Expand All @@ -78,15 +78,15 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="MSBuild.Sdk.Extras">
<Project Sdk="MSBuild.NET.Extras.Sdk">

<PropertyGroup>
<TargetFrameworks>uap10.0.17763</TargetFrameworks>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="MSBuild.Sdk.Extras">
<Project Sdk="MSBuild.NET.Extras.Sdk">

<PropertyGroup>
<TargetFrameworks>uap10.0.17763</TargetFrameworks>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="MSBuild.Sdk.Extras">
<Project Sdk="MSBuild.NET.Extras.Sdk">

<PropertyGroup>
<TargetFrameworks>uap10.0.17134</TargetFrameworks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the LICENSE file in the project root for more information.

using System;
#if WINDOWS_UWP
#if WINDOWS_UAP
using Windows.Data.Xml.Dom;
#endif

Expand Down Expand Up @@ -80,7 +80,7 @@ public override string ToString()
return GetContent();
}

#if WINDOWS_UWP
#if WINDOWS_UAP
/// <summary>
/// Retrieves the notification XML content as a WinRT Xml document.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if WINDOWS_UWP
#if WINDOWS_UAP
using Windows.Data.Xml.Dom;
#endif

Expand Down Expand Up @@ -62,7 +62,7 @@ public override string ToString()
return GetContent();
}

#if WINDOWS_UWP
#if WINDOWS_UAP
/// <summary>
/// Retrieves the notification Xml content as a WinRT Xml document.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Microsoft.Toolkit.Uwp.Notifications/Common/BaseElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.IO;
using System.Text;

#if WINDOWS_UWP
#if WINDOWS_UAP
using Windows.Data.Xml.Dom;
#endif

Expand Down Expand Up @@ -40,7 +40,7 @@ public string GetContent()
}
}

#if WINDOWS_UWP
#if WINDOWS_UAP
/// <summary>
/// Retrieves the notification XML content as a WinRT XML document.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if WINDOWS_UWP
#if WINDOWS_UAP
using Windows.Data.Xml.Dom;
#endif

Expand All @@ -19,7 +19,7 @@ public interface INotificationContent
/// <returns>The notification Xml content as a string.</returns>
string GetContent();

#if WINDOWS_UWP
#if WINDOWS_UAP
/// <summary>
/// Retrieves the notification Xml content as a WinRT Xml document.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
#if WINDOWS_UWP
#if WINDOWS_UAP

#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the LICENSE file in the project root for more information.

using System;
#if WINDOWS_UWP
#if WINDOWS_UAP

#endif

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="MSBuild.Sdk.Extras">
<Project Sdk="MSBuild.NET.Extras.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard1.4;uap10.0.16299;net461;netcoreapp3.1;net5.0;net5.0-windows10.0.17763;native</TargetFrameworks>
Expand All @@ -14,8 +14,8 @@
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netcoreapp3.1' or $(TargetFramework.Contains('windows10.0'))">
<!-- Define the WINDOWS_UWP conditional symbol, since the 'Windows.Data.Xml' and the 'Windows.UI.Notification' namespaces are available -->
<DefineConstants>$(DefineConstants);WINDOWS_UWP;WIN32</DefineConstants>
<!-- Define the WINDOWS_UAP conditional symbol, since the 'Windows.Data.Xml' and the 'Windows.UI.Notification' namespaces are available -->
<DefineConstants>$(DefineConstants);WINDOWS_UAP;WIN32</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'native'">
Expand All @@ -30,7 +30,7 @@
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<!-- Misc -->
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<DefineConstants>$(DefineConstants);WINDOWS_UWP;WINRT</DefineConstants>
<DefineConstants>$(DefineConstants);WINDOWS_UAP;WINRT</DefineConstants>
<LanguageTargets>$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets</LanguageTargets>
<!-- Workaround for issue NuGet/Home#8388; Restore conflict in VS IDE 2019 during DesignTime vs BuildTime. -->
<NuGetTargetMoniker Condition="'$(DesignTimeBuild)' != 'true'">UAP,Version=v10.0</NuGetTargetMoniker>
Expand All @@ -53,10 +53,6 @@
<PackageReference Include="System.Drawing.Common" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'native'">
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" PrivateAssets="All" />
</ItemGroup>

<!-- Native (C++) does not need 'System.ValueTuple' (plus it is incompatible with this package) -->
<ItemGroup Condition="'$(TargetFramework)' != 'native'">
<PackageReference Include="System.ValueTuple" />
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Toolkit.Uwp.Notifications/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Welcome to the Notifications section of the toolkit! This contains the Notificat

Any code for generating notifications should be written in the `Microsoft.Toolkit.Uwp.Notifications` project.

If there's UWP-specific code, use the appropriate `#ifdef`, `WINDOWS_UWP` or `WINRT`.
If there's UWP-specific code, use the appropriate `#ifdef`, `WINDOWS_UAP` or `WINRT`.

## What are all the projects for?

Expand Down
4 changes: 2 additions & 2 deletions Microsoft.Toolkit.Uwp.Notifications/Tiles/TileContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if WINDOWS_UWP
#if WINDOWS_UAP
using Windows.Data.Xml.Dom;
using Windows.UI.Notifications;
#endif
Expand All @@ -28,7 +28,7 @@ public string GetContent()
return ConvertToElement().GetContent();
}

#if WINDOWS_UWP
#if WINDOWS_UAP
/// <summary>
/// Retrieves the notification XML content as a WinRT XmlDocument, so that it can be used with a local Tile notification's constructor on either <see cref="TileNotification"/> or <see cref="ScheduledTileNotification"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if WINDOWS_UWP
#if WINDOWS_UAP

using Windows.Foundation;
using Windows.UI.Notifications;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Linq;
using System.Text;

#if WINDOWS_UWP
#if WINDOWS_UAP
using Windows.UI.Notifications;
#endif

Expand Down Expand Up @@ -79,7 +79,7 @@ private IList<IToastBindingGenericChild> VisualChildren
}
}

#if WINDOWS_UWP
#if WINDOWS_UAP
#if !WINRT
/// <summary>
/// Create an instance of NotificationData that can be used to update toast that has a progress bar.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ public ToastContent GetToastContent()
return Content;
}

#if WINDOWS_UWP
#if WINDOWS_UAP
/// <summary>
/// Retrieves the notification XML content as a WinRT XmlDocument, so that it can be used with a local Toast notification's constructor on either <see cref="Windows.UI.Notifications.ToastNotification"/> or <see cref="Windows.UI.Notifications.ScheduledToastNotification"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if WINDOWS_UWP
#if WINDOWS_UAP

using System.Collections.Generic;
using Windows.UI.Notifications;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if WINDOWS_UWP
#if WINDOWS_UAP

using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if WINDOWS_UWP
#if WINDOWS_UAP

using System.Collections.Generic;
using Windows.UI.Notifications;
Expand Down
4 changes: 2 additions & 2 deletions Microsoft.Toolkit.Uwp.Notifications/Toasts/ToastContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using System;
using System.Collections.Generic;
#if WINDOWS_UWP
#if WINDOWS_UAP
using Windows.Data.Xml.Dom;
using Windows.UI.Notifications;
#endif
Expand Down Expand Up @@ -100,7 +100,7 @@ public string GetContent()
return ConvertToElement().GetContent();
}

#if WINDOWS_UWP
#if WINDOWS_UAP

/// <summary>
/// Retrieves the notification XML content as a WinRT XmlDocument, so that it can be used with a local Toast notification's constructor on either <see cref="ToastNotification"/> or <see cref="ScheduledToastNotification"/>.
Expand Down
Loading

0 comments on commit 9a6802c

Please sign in to comment.