-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Btueffers dynamic dependency bootstrap initialize #187
Btueffers dynamic dependency bootstrap initialize #187
Conversation
@@ -2,7 +2,7 @@ | |||
|
|||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework> | |||
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are samples supposed to use .NET 5 or 6?
Is there a doc of policies and guidelines what samples are supposed to do? E.g. what version of .NET they should use?
// Initialize Windows App SDK for unpackaged apps. | ||
int result; | ||
|
||
Bootstrap.TryInitialize(majorMinorVersion, versionTag, out result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace lines 24-28 with
int result = 0;
if (!Bootstrap.TryInitialize(majorMinorVersion, versionTag, minVersion, out result))
{
Application.Run...
same applies to all
@@ -3,6 +3,7 @@ | |||
|
|||
using System; | |||
using System.Windows.Forms; | |||
using Microsoft.Windows.ApplicationModel.DynamicDependency; | |||
|
|||
namespace CsWinFormsActivation | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace lines 13-14 with
static var majorMinorVersion = global::Microsoft.WindowsAppSDK.Release.MajorMinor;
static var versionTag = global::Microsoft.WindowsAppSDK.Release.VersionTag;
static var minVersion = new global::Microsoft.Windows.ApplicationModel.DynamicDependency.PackageVersion(Microsoft.WindowsAppSDK.Runtime.Version.UInt64);
same applies to all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm @DrusTheAxe, is replacing the types with var intentional in your recommendation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It could go either way for majorMinorVersion and versionTag but general rule is objects are better as var when the right side of the = is the type e.g.
Widget x = new Widget();
is better as
var x = new Widget();
since it's unambiguous to the reader what the type of x is.
For majorMinorVersion and versionTag they're constants so for consistency var
seemed better, though one could make a case for uint
and string
.
@@ -3,6 +3,7 @@ | |||
|
|||
using System; | |||
using System.Windows.Forms; | |||
using Microsoft.Windows.ApplicationModel.DynamicDependency; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using global::Microsoft...
to avoid ambiguity if implicitUsings are enabled
@DrusTheAxe should we use As documented here: https://docs.microsoft.com/en-us/windows/apps/winui/winui3/create-your-first-winui3-app |
/azp run SamplesCI-AppLifecycle |
You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list. |
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
/azp run SamplesCI-AppLifecycle |
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
/azp run SamplesCI-AppLifecycle |
Azure Pipelines successfully started running 1 pipeline(s). |
…ps://github.com/microsoft/windowsappsdk-samples into btueffers-DynamicDependency-BootstrapInitialize
/azp run SamplesCI-AppLifecycle |
Azure Pipelines successfully started running 1 pipeline(s). |
int result = MddBootstrap.Initialize(majorMinorVersion, versionTag); | ||
if (result == 0) | ||
int result = 0; | ||
if (!Bootstrap.TryInitialize(majorMinorVersion, versionTag, minVersion, out result)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Can remove versionTag + minVersion and just use the overloaded API to get the default. Not like the actual values are listed here anyway (just symbolic names)
@@ -2,7 +2,7 @@ | |||
|
|||
<PropertyGroup> | |||
<OutputType>Exe</OutputType> | |||
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework> | |||
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're using .net6 for all samples?
We're using VS2022?
WinAppSDK 1.1 still supports .NET5? Still supports VS2019?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a PR out to change it for the C# samples template, but it's not all samples at this point. I was changing a number of C# samples all at once though so I decided to go ahead and tack on the .NET version as well.
@@ -2,7 +2,7 @@ | |||
|
|||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework> | |||
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
19041 == 20H1
Do all samples target that? RS5+19H2 are supported but not a target for samples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The C# template still targets 19041 so if not all samples then most of them would still be targeting that. We can update it in the template as well though in the same PR that the .NET version is being update in if we want to do that.
/azp run SamplesCI-AppLifecycle |
Azure Pipelines successfully started running 1 pipeline(s). |
2 similar comments
Azure Pipelines successfully started running 1 pipeline(s). |
Azure Pipelines successfully started running 1 pipeline(s). |
* Removing MddBootstrap.cs and use the new Bootstrap.Initialize API * Readding some removed code from program.cs * AppLifecycle Instancing CSConsole unpackaged * AppLifecycle StateNotifications CsConsole Unpackaged State * App Lifecycle Instancing CsWpf unpackaged * App Lifecycle Activation Cs Wpf unpackaged * App Lifecycle StateNotifications Cs WinForms Unpackaged * App Lifecycle Activation Cs console unpackaged * App Lifecycle StateNotifications Cs Wpf unpackaged * App Lifecycle Instancing Cs WinForms unpackaged * implementing some of the PR feedback * updating version variables and if statements * Fixed AppLifecycle CsWpfInstancing * Corrected variable declarations and logic
Description
Updating to use new Bootstrap Initialize API
Target Release
1.1 Preview 2 timeline
Checklist
/azp run
to have the CI build run on my branch. This must be done right before merging to ensure the build is up to date and accurate.