From 1121201a36c1bc8d657bd57a2b44923f4e92580c Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 14 May 2023 17:54:38 +0200 Subject: [PATCH 1/4] Add warning when using packages.config for MVVM Toolkit --- .../CommunityToolkit.Mvvm.targets | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets b/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets index 958c2c2e5..d481f5efe 100644 --- a/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets +++ b/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets @@ -99,4 +99,17 @@ + + + + + + + \ No newline at end of file From 9a671aa8fc2cf4a1e01018434a0792dae7d92946 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 14 May 2023 18:34:04 +0200 Subject: [PATCH 2/4] Add error code and help link for .targets warnings --- .../CommunityToolkit.Mvvm.targets | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets b/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets index d481f5efe..d90ab9d8f 100644 --- a/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets +++ b/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets @@ -54,7 +54,10 @@ emitting this manually lets us customize the message to inform developers as to why exactly the generators have been disabled, and that the rest of the MVVM Toolkit will still keep working as intended, just without additional features. --> - + @@ -109,7 +112,10 @@ This happens when either the project style is using packages.config, or when explicitly requested. See https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#restoring-packagereference-and-packagesconfig-projects-with-msbuild. --> - + \ No newline at end of file From 14b7672d20557ac5036251ae1c57f2ae571e312a Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 14 May 2023 19:51:47 +0200 Subject: [PATCH 3/4] Manually look for a packages.config file in builds --- .../CommunityToolkit.Mvvm.targets | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets b/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets index d90ab9d8f..b135d50d3 100644 --- a/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets +++ b/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets @@ -106,13 +106,35 @@ - + - + true + + + + + + + + + + true + + + + From 0071d6a912689dbc322b97809b8d7c74eb7febca Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 14 May 2023 21:01:48 +0200 Subject: [PATCH 4/4] Skip checking for packages.config in SDK-style projects --- .../CommunityToolkit.Mvvm.targets | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets b/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets index b135d50d3..aa4b8966f 100644 --- a/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets +++ b/src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets @@ -102,15 +102,19 @@ - + + Condition="'$(UsingMicrosoftNetSDK)' != 'true'"> true @@ -120,6 +124,8 @@ If no packages.config properties are set, also try to manually find the packages.config file. This will be in the @(None) elements, if present. Doing so makes sure this works in builds as well, since the implicit targets populating the properties above only run when restoring. + Since the packages.config file will always be in the root of the project, if present, we will + match with the full item spec (see https://learn.microsoft.com/nuget/reference/packages-config). -->