Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add warning when using packages.config for MVVM Toolkit
  • Loading branch information
Sergio0694 committed May 14, 2023
commit 1121201a36c1bc8d657bd57a2b44923f4e92580c
13 changes: 13 additions & 0 deletions src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,17 @@
</ItemGroup>
</Target>

<!-- Remove the analyzer if packages.config is used -->
<Target Name="MVVMToolkitWarnForPackagesConfigUse"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
DependsOnTargets="MVVMToolkitGatherAnalyzers">

<!--
Emit a warning in case packages.config is used, by reading the associated MSBuild property.
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.
-->
<Warning Condition ="'$(RestorePackagesConfig)' == 'true' OR '$(RestoreProjectStyle)' == 'PackagesConfig'" Text="The MVVM Toolkit source generators might not be loaded correctly, as the current project is using the packages.config setup to restore NuGet packages. Source generators require PackageReference to be used (either in a legacy-style or SDK-style .csproj project, both are supported as long as PackageReference is used)."/>
</Target>

</Project>