Skip to content

Commit a2ad738

Browse files
committed
Make the C# language check a warning instead of an error
Instead of reporting an error (both on BeforeCompile and CoreCompile) when we detect the project language isn't C# 9.0+, which breaks design-time builds (in addition to full builds) and causes bad IDE experience right-after install, make it a warning instead. This gives the user the chance to build, perhaps attempt to type ThisAssembly and see that nothing happens, note the warning, and then cleanly uninstall the package. Fixes #51
1 parent 1a40e95 commit a2ad738

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.targets

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
Condition="$([System.Version]::Parse('16.8.0').CompareTo($([System.Version]::Parse($(MSBuildVersion))))) == 1" />
77

88
<!-- See https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/langversion-compiler-option -->
9-
<Error Text="ThisAssembly uses Roslyn source generators, which are only supported in C# 9.0 or greater at the moment."
10-
Condition="'$(Language)' != 'C#' OR
11-
('$(LangVersion)' != 'preview' AND
12-
'$(LangVersion)' != 'latest' AND
13-
'$(LangVersion)' != 'latestMajor' AND
14-
'$(LangVersion)' &lt; '9.0')" />
9+
<Warning Code="THIS001"
10+
Text="ThisAssembly uses Roslyn source generators, which are only supported in C# 9.0 or greater at the moment."
11+
Condition="'$(Language)' != 'C#' OR
12+
('$(LangVersion)' != 'preview' AND
13+
'$(LangVersion)' != 'latest' AND
14+
'$(LangVersion)' != 'latestMajor' AND
15+
'$(LangVersion)' &lt; '9.0')" />
1516
</Target>
1617

1718
</Project>

0 commit comments

Comments
 (0)