diff --git a/src/Workload/Microsoft.Maui.Sdk/Sdk/BundledVersions.in.targets b/src/Workload/Microsoft.Maui.Sdk/Sdk/BundledVersions.in.targets index a23055420e8a..960e3e346750 100644 --- a/src/Workload/Microsoft.Maui.Sdk/Sdk/BundledVersions.in.targets +++ b/src/Workload/Microsoft.Maui.Sdk/Sdk/BundledVersions.in.targets @@ -12,6 +12,12 @@ however Visual Studio currently depends on this assembly being loaded for Live Visual Tree. --> true + + + true - + <_MauiImplicitPackageReference Include="Microsoft.Maui.Resizetizer" Version="$(MauiVersion)" PrivateAssets="all" Condition=" '$(UseMauiAssets)' == 'true' " /> <_MauiImplicitPackageReference Include="Microsoft.Maui.Essentials" Version="$(MauiVersion)" Condition=" '$(UseMauiEssentials)' == 'true' "> all @@ -48,7 +54,7 @@ - + <_MauiImplicitPackageReference Remove="@(PackageReference)" /> <_MauiImplicitRequiredPackageReference Include="@(_MauiImplicitPackageReference->WithMetadataValue('IsMauiImplicitOptionalPackageReference',''))" /> @@ -59,7 +65,7 @@ AfterTargets="CollectPackageReferences" Condition=" ('$(SkipValidateMauiImplicitPackageReferences)' != 'true') and - ('$(EnableMauiImplicitPackageReferences)' != 'false' and '$(UseMauiNuGets)' != 'true') and + ('$(DisableMauiImplicitPackageReferences)' != 'true' and '$(UseMauiNuGets)' != 'true') and ('$(UseMaui)' == 'true' or '$(UseMauiCore)' == 'true' or '$(UseMauiEssentials)' == 'true' or '$(UseMauiAssets)' == 'true') and ('@(_MauiImplicitRequiredPackageReference->Count())' != '0') "> diff --git a/src/Workload/README.md b/src/Workload/README.md index 6bb6103a5696..f4f123680242 100644 --- a/src/Workload/README.md +++ b/src/Workload/README.md @@ -214,3 +214,57 @@ These folders are all .NET 6 specific, so they won't affect .NET 5 or older versions. After this you can install .NET 6 with a fresh install of your choice. + +## NuGet Central Package Management + +You can leverage [NuGet's central package management (CPM)][cpm] to manage all +of your dependencies from a single location. + +To do this, you will need a `Directory.Packages.props` file with: + +```xml + + + true + 8.0.0 + 8.0.0 + + + + + + + + + + + + +``` + +For the correct value for `$(MauiVersion)` and `$(MicrosoftExtensionsVersion)` +you will need to find a valid version number from one of: + +* NuGet, such as: https://www.nuget.org/packages/Microsoft.Maui.Sdk + +* GitHub releases, such as: https://github.com/dotnet/maui/releases + +Using properties like `$(MauiVersion)` and `$(MicrosoftExtensionsVersion)` are +also completely optional, you can put the version numbers directly in the +`%(PackageVersion.Version)` item metadata. + +Then in your .NET MAUI application's `.csproj` file: + +```xml + + + + + +``` + +Note that `%(PackageReference.Version)` is intentionally left blank. See the +documentation on [NuGet Central Package Management][cpm] for more information +about this feature. + +[cpm]: https://learn.microsoft.com/nuget/consume-packages/Central-Package-Management