-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[templates] remove Directory.Build.targets, add @(ProjectCapability) #1433
[templates] remove Directory.Build.targets, add @(ProjectCapability) #1433
Conversation
This allows easily toggling of debug target TFM by selecting the platform. | ||
If removed, top level debug targets show as a list of devices for the selected TFM. | ||
--> | ||
<ProjectCapability Include="XamarinStaticLaunchProfiles" /> |
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 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.
@tondat is suggesting in Teams we might change to:
<ItemGroup>
<ProjectCapability Include="MauiSingleProject" />
<ProjectCapability Include="LaunchProfilesGroupByPlatformFilters"/>
<ProjectCapability Include="BuildOnlyActiveTargetFrameworkOnDebug" />
</ItemGroup>
Also, a target that would improve the developer loop (until we get the appropriate Project System changes);
<Target Name="ComputeXamarinTargetFrameworks" BeforeTargets="_ComputeTargetFrameworkItems">
<PropertyGroup>
<TargetFrameworks Condition="'$(TargetFramework)' == '' AND '$(_SelectedTargetFramework)' != ''">$(_SelectedTargetFramework)</TargetFrameworks>
</PropertyGroup>
<Message Text="SelectedTargetFramework = $(_SelectedTargetFramework)" />
<Message Text="TargetFramework = $(TargetFramework)" />
<Message Text="TargetFrameworks = $(TargetFrameworks)" />
<Message Text="BuildingInsideVisualStudio = $(BuildingInsideVisualStudio)" />
</Target>
I'll want to test this target a bit, and probably refactor it.
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.
Final capabilities might be:
<ItemGroup>
<ProjectCapability Include="MauiSingleProject" />
<ProjectCapability Include="XamarinStaticLaunchProfiles" Condition=" '$(VisualStudioVersion)' < '17.0' " />
<ProjectCapability Include="LaunchProfilesGroupByPlatformFilters" Condition=" '$(VisualStudioVersion)' >= '17.0' " />
<ProjectCapability Include="BuildOnlyActiveTargetFrameworkOnDebug" />
</ItemGroup>
LaunchProfilesGroupByPlatformFilters
is Dev17-only, and you can't have XamarinStaticLaunchProfiles
at the same time.
c936c6d
to
c53e06d
Compare
ComputeXamarinTargetFrameworks targetIt does not appear that adding this target will currently work:
This needs to run in the "outer" build when ProjectCapabilityI think the current logic here is right, but my IDE isn't working as expected. I don't have a way to select my Android emulator, it fails to deploy when I hit the Play button: TBD if this is an IDE issue, or something else related to workloads. |
|
c53e06d
to
b5033f1
Compare
b5033f1
to
db88124
Compare
Directory.Build.targets
Outdated
@@ -10,20 +10,6 @@ | |||
<PublishTrimmed Condition=" '$(TargetFramework)' == 'net6.0-ios' or '$(TargetFramework)' == 'net6.0-maccatalyst' ">false</PublishTrimmed> |
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.
@mattleibow can we remove this now?
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.
Maybe. I know I did in my pr and I think the issue was that we were using Xcode 12. Now with Xcode 13 all over, we probably can remove it.
<Target Name="ValidateWinUIPlatform" /> | ||
<Target Name="BinPlaceBootstrapDll" /> |
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.
Does this come in late enough? The WinUI targets from the nugets create this target, and we have to overwrite with a dummy.
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.
This is imported as late as a workload can do it:
maui/src/Workload/Microsoft.Maui.Controls.Sdk/Sdk/Microsoft.Maui.Controls.Sdk.After.targets
Line 9 in f95c2e5
<Import Project="WinUI.targets" Condition=" '$(TargetPlatformIdentifier)' == 'windows' " /> |
maui/src/Workload/Microsoft.Maui.Controls.Sdk/Sdk/Microsoft.Maui.Controls.Sdk.targets
Lines 14 to 16 in f95c2e5
<PropertyGroup> | |
<AfterMicrosoftNETSdkTargets>$(AfterMicrosoftNETSdkTargets);$(MSBuildThisFileDirectory)Microsoft.Maui.Controls.Sdk.After.targets</AfterMicrosoftNETSdkTargets> | |
</PropertyGroup> |
We'd need to test, but if it doesn't work we'd have to put the Directory.Build.targets
back.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
The `Directory.Build.targets` files in the templates were a collection of workarounds that were needed until .NET MAUI was a workload. When .NET MAUI was a NuGet package, this was the only way to set required values for the IDE before NuGet restore. In the early days, you had to unload/reload MAUI projects after NuGet restore. We can remove `Directory.Build.targets` from templates now, and consolidate `@(ProjectCapability)` so this is defined by the workload. The following capabilities are defined for the IDE: * `Maui` * When `$(SingleProject)` is `true`: * `MauiSingleProject`, `LaunchProfiles` * `XamarinStaticLaunchProfiles` older than Dev17 * `LaunchProfilesGroupByPlatformFilters` otherwise These new capabilities are defined to identify projects (via telemetry) that bring in portions of .NET MAUI: * `MauiAssets` * `MauiBlazor` * `MauiCore` * `MauiEssentials` Other changes: * `$(_KeepLaunchProfiles)` is set by default when `$(SingleProject)` is `true`. * WinUI workarounds are moved into `WinUI.SingleProject.targets`. * Fixed `sdk-manifests` casing for `src/DotNet/DotNet.csproj -t:Install`
24a67a3
to
72f5134
Compare
Description of Change
The
Directory.Build.targets
files in the templates were a collectionof workarounds that were needed until .NET MAUI was a workload. When
.NET MAUI was a NuGet package, this was the only way to set required
values for the IDE before NuGet restore. In the early days, you had to
unload/reload MAUI projects after NuGet restore.
We can remove
Directory.Build.targets
from templates now, andconsolidate
@(ProjectCapability)
so this is defined by the workload.The following capabilities are defined for the IDE:
Maui
MauiSingleProject
,LaunchProfiles
,XamarinStaticLaunchProfiles
when
$(SingleProject)
istrue
These new capabilities are defined to identify projects (via telemetry)
that bring in portions of .NET MAUI:
MauiAssets
MauiBlazor
MauiCore
MauiEssentials
Other changes:
$(_KeepLaunchProfiles)
is set by default when$(SingleProject)
is
true
.WinUI.SingleProject.targets
.sdk-manifests
casing forsrc/DotNet/DotNet.csproj -t:Install
PR Checklist
Does this PR touch anything that might affect accessibility?
No