Skip to content

Commit

Permalink
[workload] use **FromWorkload** for targeting/runtime pack versions
Browse files Browse the repository at this point in the history
Context: dotnet/sdk#19596

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file for
projects when you have the `maui` workload installed.

One caveat for dotnet/maui is we have a `$(MicrosoftMauiSdkVersion)`.
We'll need to use `**FromWorkload**` in some places, and the actual
number when declaring `@(PackageReference)`.
  • Loading branch information
jonathanpeppers committed Aug 17, 2021
1 parent 7a6459b commit 70be46e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 44 deletions.
8 changes: 0 additions & 8 deletions src/Controls/samples/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,5 @@
<UseMaui Condition=" '$(UseWorkload)' == 'true' ">true</UseMaui>
</PropertyGroup>
<Import Project="../../../Directory.Build.props" />
<!--
We don't want to use cached Microsoft.Maui.* runtime packs.
This can be removed when we get: https://github.com/dotnet/sdk/issues/14044
-->
<PropertyGroup Condition=" '$(UseMaui)' == 'true' ">
<RestoreNoCache>true</RestoreNoCache>
<RestorePackagesPath>$(MauiRootDirectory)packages/</RestorePackagesPath>
</PropertyGroup>
<Import Project="Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />
</Project>
10 changes: 0 additions & 10 deletions src/DotNet/DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,6 @@
/>
<Delete Files="$(_NuGetConfig)" />

<!--
HACK: temporarily put runtime packs in 'library-packs', until they can be resolved from 'packs'
See: https://github.com/dotnet/sdk/issues/14044
-->
<ItemGroup>
<_RuntimePacks Include="$(PackageOutputPath)/*.Runtime.*.nupkg" />
<_RuntimePacks Include="$(PackageOutputPath)/Microsoft.Maui.Extensions.*.nupkg" />
</ItemGroup>
<Copy SourceFiles="@(_RuntimePacks)" DestinationFolder="$(MSBuildExtensionsPath)../../library-packs" SkipUnchangedFiles="true" />

</Target>

<!-- Eventually replaced by eng/Version.targets -->
Expand Down
8 changes: 0 additions & 8 deletions src/Essentials/samples/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,5 @@
<UseMaui Condition=" '$(UseWorkload)' == 'true' ">true</UseMaui>
</PropertyGroup>
<Import Project="../../../Directory.Build.props" />
<!--
We don't want to use cached Microsoft.Maui.* runtime packs.
This can be removed when we get: https://github.com/dotnet/sdk/issues/14044
-->
<PropertyGroup Condition=" '$(UseMaui)' == 'true' ">
<RestoreNoCache>true</RestoreNoCache>
<RestorePackagesPath>$(MauiRootDirectory)packages/</RestorePackagesPath>
</PropertyGroup>
<Import Project="Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Project>
<PropertyGroup>
<_MauiRuntimePackVersion>$(MicrosoftMauiSdkVersion)</_MauiRuntimePackVersion>
<_MauiRuntimePackVersion Condition=" '$(_MauiRuntimePackVersion)' == '' ">**FromWorkload**</_MauiRuntimePackVersion>
<MicrosoftMauiSdkVersion Condition=" '$(MicrosoftMauiSdkVersion)' == '' ">@VERSION@</MicrosoftMauiSdkVersion>
<!-- $(_MauiPlatformName) is used as RIDs as well as a suffix to targeting pack names -->
<_MauiPlatformName Condition=" '$(TargetPlatformIdentifier)' == 'windows' ">win</_MauiPlatformName>
Expand All @@ -15,10 +17,10 @@
Include="Microsoft.Maui.Extensions"
TargetFramework="net6.0"
RuntimeFrameworkName="Microsoft.Maui.Extensions"
DefaultRuntimeFrameworkVersion="$(MicrosoftMauiSdkVersion)"
LatestRuntimeFrameworkVersion="$(MicrosoftMauiSdkVersion)"
DefaultRuntimeFrameworkVersion="$(_MauiRuntimePackVersion)"
LatestRuntimeFrameworkVersion="$(_MauiRuntimePackVersion)"
TargetingPackName="Microsoft.Maui.Extensions"
TargetingPackVersion="$(MicrosoftMauiSdkVersion)"
TargetingPackVersion="$(_MauiRuntimePackVersion)"
RuntimePackNamePatterns="Microsoft.Maui.Extensions"
RuntimePackRuntimeIdentifiers="any"
/>
Expand All @@ -27,10 +29,10 @@
Include="Microsoft.Maui.Core"
TargetFramework="net6.0"
RuntimeFrameworkName="Microsoft.Maui.Core"
DefaultRuntimeFrameworkVersion="$(MicrosoftMauiSdkVersion)"
LatestRuntimeFrameworkVersion="$(MicrosoftMauiSdkVersion)"
DefaultRuntimeFrameworkVersion="$(_MauiRuntimePackVersion)"
LatestRuntimeFrameworkVersion="$(_MauiRuntimePackVersion)"
TargetingPackName="Microsoft.Maui.Core.Ref.$(_MauiPlatformName)"
TargetingPackVersion="$(MicrosoftMauiSdkVersion)"
TargetingPackVersion="$(_MauiRuntimePackVersion)"
RuntimePackNamePatterns="Microsoft.Maui.Core.Runtime.**RID**"
RuntimePackRuntimeIdentifiers="$(_MauiPlatformName)"
Profile="$(TargetPlatformIdentifier)"
Expand All @@ -40,10 +42,10 @@
Include="Microsoft.Maui.Controls"
TargetFramework="net6.0"
RuntimeFrameworkName="Microsoft.Maui.Controls"
DefaultRuntimeFrameworkVersion="$(MicrosoftMauiSdkVersion)"
LatestRuntimeFrameworkVersion="$(MicrosoftMauiSdkVersion)"
DefaultRuntimeFrameworkVersion="$(_MauiRuntimePackVersion)"
LatestRuntimeFrameworkVersion="$(_MauiRuntimePackVersion)"
TargetingPackName="Microsoft.Maui.Controls.Ref.$(_MauiPlatformName)"
TargetingPackVersion="$(MicrosoftMauiSdkVersion)"
TargetingPackVersion="$(_MauiRuntimePackVersion)"
RuntimePackNamePatterns="Microsoft.Maui.Controls.Runtime.**RID**"
RuntimePackRuntimeIdentifiers="$(_MauiPlatformName)"
Profile="$(TargetPlatformIdentifier)"
Expand All @@ -53,10 +55,10 @@
Include="Microsoft.Maui.Essentials"
TargetFramework="net6.0"
RuntimeFrameworkName="Microsoft.Maui.Essentials"
DefaultRuntimeFrameworkVersion="$(MicrosoftMauiSdkVersion)"
LatestRuntimeFrameworkVersion="$(MicrosoftMauiSdkVersion)"
DefaultRuntimeFrameworkVersion="$(_MauiRuntimePackVersion)"
LatestRuntimeFrameworkVersion="$(_MauiRuntimePackVersion)"
TargetingPackName="Microsoft.Maui.Essentials.Ref.$(_MauiPlatformName)"
TargetingPackVersion="$(MicrosoftMauiSdkVersion)"
TargetingPackVersion="$(_MauiRuntimePackVersion)"
RuntimePackNamePatterns="Microsoft.Maui.Essentials.Runtime.**RID**"
RuntimePackRuntimeIdentifiers="$(_MauiPlatformName)"
Profile="$(TargetPlatformIdentifier)"
Expand Down
6 changes: 0 additions & 6 deletions src/Workload/Shared/FrameworkList.targets
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,4 @@
</ItemGroup>
</Target>

<!--
HACK: temporarily put runtime packs in 'library-packs', until they can be resolved from 'packs'
See: https://github.com/dotnet/sdk/issues/14044
-->
<Import Condition=" !$(MSBuildProjectName.Contains('.Ref')) " Project="LibraryPacks.targets" />

</Project>

0 comments on commit 70be46e

Please sign in to comment.