Skip to content

Commit 3e38237

Browse files
committed
Add 'ValidateWinRTRuntimeDllVersion2References'
1 parent 13630f4 commit 3e38237

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/RunCsWinRTGenerator.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ public sealed class RunCsWinRTGenerator : ToolTask
7171
/// </summary>
7272
public bool ValidateWinRTRuntimeAssemblyVersion { get; init; } = true;
7373

74+
/// <summary>
75+
/// Gets whether to validate that any references to <c>WinRT.Runtime.dll</c> version 2 are present across any assemblies.
76+
/// </summary>
77+
public bool ValidateWinRTRuntimeDllVersion2References { get; init; } = true;
78+
7479
/// <summary>
7580
/// Gets whether to treat warnings coming from 'cswinrtgen' as errors (regardless of the global 'TreatWarningsAsErrors' setting).
7681
/// </summary>
@@ -207,6 +212,7 @@ protected override string GenerateResponseFileCommands()
207212
AppendResponseFileOptionalCommand(args, "--debug-repro-directory", DebugReproDirectory);
208213
AppendResponseFileCommand(args, "--use-windows-ui-xaml-projections", UseWindowsUIXamlProjections.ToString());
209214
AppendResponseFileCommand(args, "--validate-winrt-runtime-assembly-version", ValidateWinRTRuntimeAssemblyVersion.ToString());
215+
AppendResponseFileCommand(args, "--validate-winrt-runtime-dll-version-2-references", ValidateWinRTRuntimeDllVersion2References.ToString());
210216
AppendResponseFileCommand(args, "--treat-warnings-as-errors", TreatWarningsAsErrors.ToString());
211217
AppendResponseFileCommand(args, "--max-degrees-of-parallelism", MaxDegreesOfParallelism.ToString());
212218

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Windows.targets

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ Copyright (c) .NET Foundation. All rights reserved.
183183
<CsWinRTToolsDirectory Condition="'$(CsWinRTToolsDirectory)' == ''"></CsWinRTToolsDirectory>
184184
<CsWinRTToolsArchitecture Condition="'$(CsWinRTToolsArchitecture)' == ''"></CsWinRTToolsArchitecture>
185185
<CsWinRTGeneratorInteropAssemblyDirectory Condition="'$(CsWinRTGeneratorInteropAssemblyDirectory)' == ''">$(IntermediateOutputPath)</CsWinRTGeneratorInteropAssemblyDirectory>
186-
<CsWinRTGeneratorValidateWinRTRuntimeAssemblyVersion Condition="'$(ValidateWinRTRuntimeAssemblyVersion)' == ''">true</CsWinRTGeneratorValidateWinRTRuntimeAssemblyVersion>
186+
<CsWinRTGeneratorValidateWinRTRuntimeAssemblyVersion Condition="'$(CsWinRTGeneratorValidateWinRTRuntimeAssemblyVersion)' == ''">true</CsWinRTGeneratorValidateWinRTRuntimeAssemblyVersion>
187+
<CsWinRTGeneratorValidateWinRTRuntimeDllVersion2References Condition="'$(CsWinRTGeneratorValidateWinRTRuntimeDllVersion2References)' == ''">true</CsWinRTGeneratorValidateWinRTRuntimeDllVersion2References>
187188
<CsWinRTGeneratorTreatWarningsAsErrors Condition="'$(CsWinRTGeneratorTreatWarningsAsErrors)' == ''">false</CsWinRTGeneratorTreatWarningsAsErrors>
188189
<CsWinRTGeneratorMaxDegreesOfParallelism Condition="'$(CsWinRTGeneratorMaxDegreesOfParallelism)' == ''">-1</CsWinRTGeneratorMaxDegreesOfParallelism>
189190
<CsWinRTGeneratorStandardOutputImportance Condition="'$(CsWinRTGeneratorStandardOutputImportance)' == ''">High</CsWinRTGeneratorStandardOutputImportance>
@@ -246,6 +247,7 @@ Copyright (c) .NET Foundation. All rights reserved.
246247
<_RunCsWinRTGeneratorInputsCacheToHash Include="$(CsWinRTGeneratorDebugReproDirectory)" />
247248
<_RunCsWinRTGeneratorInputsCacheToHash Include="$(CsWinRTUseWindowsUIXamlProjections)" />
248249
<_RunCsWinRTGeneratorInputsCacheToHash Include="$(CsWinRTGeneratorValidateWinRTRuntimeAssemblyVersion)" />
250+
<_RunCsWinRTGeneratorInputsCacheToHash Include="$(CsWinRTGeneratorValidateWinRTRuntimeDllVersion2References)" />
249251
<_RunCsWinRTGeneratorInputsCacheToHash Include="$(CsWinRTGeneratorTreatWarningsAsErrors)" />
250252
<_RunCsWinRTGeneratorInputsCacheToHash Include="$(CsWinRTGeneratorMaxDegreesOfParallelism)" />
251253
<_RunCsWinRTGeneratorInputsCacheToHash Include="$(CsWinRTGeneratorLogStandardErrorAsError)" />
@@ -291,6 +293,7 @@ Copyright (c) .NET Foundation. All rights reserved.
291293
CsWinRTToolsArchitecture="$(CsWinRTToolsArchitecture)"
292294
UseWindowsUIXamlProjections="$(CsWinRTUseWindowsUIXamlProjections)"
293295
ValidateWinRTRuntimeAssemblyVersion="$(CsWinRTGeneratorValidateWinRTRuntimeAssemblyVersion)"
296+
ValidateWinRTRuntimeDllVersion2References="$(CsWinRTGeneratorValidateWinRTRuntimeDllVersion2References)"
294297
TreatWarningsAsErrors="$(CsWinRTGeneratorTreatWarningsAsErrors)"
295298
MaxDegreesOfParallelism="$(CsWinRTGeneratorMaxDegreesOfParallelism)"
296299
AdditionalArguments="@(CsWinRTGeneratorAdditionalArgument)"

0 commit comments

Comments
 (0)