Skip to content

Commit 9a671aa

Browse files
committed
Add error code and help link for .targets warnings
1 parent 1121201 commit 9a671aa

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@
5454
emitting this manually lets us customize the message to inform developers as to why exactly the generators have been
5555
disabled, and that the rest of the MVVM Toolkit will still keep working as intended, just without additional features.
5656
-->
57-
<Warning Condition ="'$(MVVMToolkitCurrentCompilerVersionIsNotNewEnough)' == 'true'" Text="The MVVM Toolkit source generators have been disabled on the current configuration, as they need Roslyn 4.x in order to work. The MVVM Toolkit will work just fine, but features relying on the source generators will not be available."/>
57+
<Warning Condition ="'$(MVVMToolkitCurrentCompilerVersionIsNotNewEnough)' == 'true'"
58+
Code="MVVMTKCFG0001"
59+
HelpLink="https://aka.ms/mvvmtoolkit/errors/mvvmtkcfg0001"
60+
Text="The MVVM Toolkit source generators have been disabled on the current configuration, as they need Roslyn 4.x in order to work. The MVVM Toolkit will work just fine, but features relying on the source generators will not be available."/>
5861

5962
<PropertyGroup>
6063

@@ -109,7 +112,10 @@
109112
This happens when either the project style is using packages.config, or when explicitly requested.
110113
See https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#restoring-packagereference-and-packagesconfig-projects-with-msbuild.
111114
-->
112-
<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)."/>
115+
<Warning Condition ="'$(RestorePackagesConfig)' == 'true' OR '$(RestoreProjectStyle)' == 'PackagesConfig'"
116+
Code="MVVMTKCFG0002"
117+
HelpLink="https://aka.ms/mvvmtoolkit/errors/mvvmtkcfg0002"
118+
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)."/>
113119
</Target>
114120

115121
</Project>

0 commit comments

Comments
 (0)