1.找到 WindowsDriver.Default.props 如果没有找到,则找 WindowsDriver.OSTargets.props
将
<PropertyGroup>
<SpectreMitigation Condition="'$(SpectreMitigation)' == ''">Spectre</SpectreMitigation>
</PropertyGroup>
改为
<PropertyGroup>
<SpectreMitigation Condition="'$(SpectreMitigation)' == ''">false</SpectreMitigation>
</PropertyGroup>
2.找到 Microsoft.Cpp.WDK.props,根据你的配置找到相应的x86或者x64,这里是 x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Platforms\x64\ImportBefore\Default\Microsoft.Cpp.WDK.props
将
<PropertyGroup>
<SpectreMitigation Condition="'$(SpectreMitigation)' == ''">Spectre</SpectreMitigation>
</PropertyGroup>
改为
<PropertyGroup>
<SpectreMitigation Condition="'$(SpectreMitigation)' == ''">false</SpectreMitigation>
</PropertyGroup>