-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Adjust properties to allow muti-target #2869
Conversation
@@ -13,13 +13,11 @@ Copyright (c) .NET Foundation. All rights reserved. | |||
|
|||
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" /> | |||
|
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.
Most of the sdk.props and sdk.targets are empty now since props and targets are directly imported by SDK
@@ -1,40 +1,6 @@ | |||
<Project> | |||
<PropertyGroup> |
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.
Moved to target
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.
Instead of moving the code, just add import into WinFX targets, if they are not already imported.
OR Is that pattern not preferred?
<ItemGroup Condition=" ('$(EnableDefaultItems)' == 'true') And ('$(UseWPF)' == 'true') And | ||
('$(_TargetFrameworkVersionValue)' != '$(_UndefinedTargetFrameworkVersion)') And | ||
('$(_TargetFrameworkVersionValue)' >= '$(_WindowsDesktopSdkTargetFrameworkVersionFloor)')"> | ||
<ItemGroup Condition=" '$(_EnableWindowsDesktopGlobbing)' == 'true' "> |
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.
Extract a new property in target to reduce the surface area, since props will always be imported
@@ -1,16 +0,0 @@ | |||
<Project> | |||
<PropertyGroup> |
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.
Moved to WinFx.target
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.
Instead of moving the code, just add import into WinFX targets, if they are not already imported.
OR Is that pattern not preferred?
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.
In this case, props will be imported regardless if the workload is installed or not. So we need to move everything that could be moved.
For more see the description, linked issue. As well as the doc related to the net5.0 design.
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.
You could keep the logic in the props file and import it in the Sdk targets. No need to move the logic and risk losing history. -- Just a suggestion
|
||
<!-- PropertyGroup flags control if Itemgroups in Microsoft.NET.Sdk.WindowsDesktop.props file is being imported --> | ||
<PropertyGroup> | ||
<_EnableWindowsDesktopGlobbing Condition=" ('$(EnableDefaultItems)' == 'true') And ('$(UseWPF)' == 'true') And |
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.
Please make sure the name looks good @dsplaisted
@dsplaisted also I realized later the first insertion to SDK will fail without SDK side of change. However, I think that is fine, we can merge the SDK side of change with the insertion |
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.
Architecturally you have to understand Pbt.props/Pbt.targets before attempting this surgery. Microsoft.DotNet.Arcade.Wpf.Sdk and dotnet-wpf-test repo has dependencies in this architecture. Any change must be compatible with the test repo, or corresponding changes must be propagated there.
I highly recommend putting up PR’s involving deep refactoring that build cleanly on “build -pack”, or start with a WIP/draft PR for now until things firm-up.
A few hints:
- In this repo, never build locally without “-pack”.
- Release and Debug build a bit differently - exercise them both
- Platform x86 is the default (unlike other repos where x64 is the default).
- x86 is where the bait-and-switch packages are built.
- AnyCpu is the same as x86 - there is no AnyCpu really, because C++/CLI is integral to the build.
- Do not build from VS Developer command prompt - use vanilla powershell or cmd
- Documentation/wpf.vsconfig + >= Dev16.5
- If you set up a branch under “experimental/, you can get CI and PR builds for free. Combine it with “General Testing” channel for experiments that need those.
@vatsan-madhavan let's setup a time to discuss that. I am surprised that .NET Core SDK is not the only public facing dependent. |
Microsoft.DotNet.Arcade.Wpf.Sdk is internal to WPF repos and it’s used in managing our dual-repo (or 3 repo, if you include test) build orchestration. Think of it as an augmentation to Arcade that includes all of WPF’s build intelligence and overrides, including the ability to do markup compilation from sources before WindowsDesktop SDK is built. That last part is what’s coming from Pbt.*. This project is going to require some experimenting and getting things right. I’d recommend spending some time building the 3 repos and getting to know Microsoft.DotNet.Arcade.Wpf.Sdk, how local markup compilation works and how we build other wpf repos etc. MSBuild Binlogs are your friend. Also spend time understanding the packaging architecture - it’s pretty powerful and unique to our repo. There is nothing magic about it, but there is a lot of convention-based stuff going on. |
Could you add properties to detect multiple inclusion, and simply include WindowsDesktop SDK from with the base Microsoft.NET.Sdk ? Then if Net.Sdk.WindowsDesktop includes Microsoft.NET.Sdk, then Microsoft.NET.Sdk has to detect this condition (Net.Sdk.WindowsDesktop would have already set a property) and avoid re-inclusion. And if Microsoft.NET.Sdk is above, and includes Net.Sdk.WindowsDesktop (owning to UseWpf or UseWindowsForms), then Net.Sdk.WindowsDesktop has to detect this condition (probably by leveraging a property set by Microsoft.NET.Sdk) and avoid re-inclusion of Microsoft.NET.Sdk |
Actually I don't think there is a case multiple inclusion will occur. There is graph of import |
I updated my PR. This should be a "refactoring". So there should be no visible change from outside (no SDK import method change) |
Can someone still FrameworkReference? People have been using that idiom to get WPF/WinForms binaries in console apps. This change shouldn't break those projects. |
Yes, adding an explicit FrameworkReference should not be impacted by these changes. |
Any update? |
Ping. It is been more than a month |
I'll be testing this today and tomorrow. Thanks. |
This will require an update to the SDK in all projects in https://github.com/microsoft/WPF-Samples. |
How will they need to update? The intent is that existing projects should continue to work. It would be good to update the samples to the new project format once we ship an SDK that supports it. However I wouldn't expect the samples to break with this change. Was there a break you ran into? |
Please disregard. I haven't seen anything break, and it looks like the samples are still building against 3.1. |
All samples from the wpf-samples repo I've tested are building successfully against these changes. The updates to the props/targets files did not cause any regressions with building existing .NET 5 applications. To clarify the goal and staging of this feature: @wli3 is enabling WPF applications to build with Project SDK set to |
@vatsan-madhavan could you dismiss your "change required"? So I can merge |
also looks like WIP bot get stuck (it was removed across the org). Maybe I need to create a new PR just to workaround that |
Continue here #3111 |
without special Sdk="Microsoft.NET.Sdk.WindowsDesktop"
The project could look like