Skip to content

Commit edf05ca

Browse files
committed
Show warning when attributes are explicitly requested for an unsupported language
1 parent 9c943a2 commit edf05ca

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

IDisposableAnalyzers/build/IDisposableAnalyzers.targets

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,18 @@
66
<IncludeOwnershipAttributes Condition="'$(IncludeOwnershipAttributes)' == '' and Exists($(OwnershipAttributesPath))">true</IncludeOwnershipAttributes>
77
</PropertyGroup>
88

9-
<ItemGroup Condition="'$(IncludeOwnershipAttributes)' == 'true'">
9+
<ItemGroup Condition="'$(IncludeOwnershipAttributes)' == 'true' and Exists($(OwnershipAttributesPath))">
1010
<Compile Include="$(OwnershipAttributesPath)" Visible="false" />
1111

1212
<!-- Workaround for https://github.com/dotnet/wpf/issues/810 -->
1313
<_GeneratedCodeFiles Include="$(OwnershipAttributesPath)" Visible="false" Condition="'$(UseWPF)' == 'true'" />
1414
</ItemGroup>
1515

16+
<Target Name="OwnershipAttributesRequestedForUnsupportedLanguage"
17+
Condition="'$(IncludeOwnershipAttributes)' == 'true' and !Exists($(OwnershipAttributesPath))"
18+
BeforeTargets="Compile">
19+
20+
<Warning Code="IDISP0026" Text="The project specifies &lt;IncludeOwnershipAttributes&gt;true&lt;/IncludeOwnershipAttributes&gt;, but including attributes in this language is not yet supported." />
21+
</Target>
22+
1623
</Project>

0 commit comments

Comments
 (0)