Make Roslyn Analyzers opt-in at compile-time (resolves #1813)
They are still run by the IDE at design-time. To opt-in, set the MSBuild property MachineRunAnalyzersDuringBuild. From the command-line, you can do this by adding `/p:MachineRunAnalyzersDuringBuild=true`.
This commit is contained in:
parent
551a7e2893
commit
215de3c0c0
|
@ -8,8 +8,8 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" PrivateAssets="All" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" PrivateAssets="All" />
|
||||||
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" PrivateAssets="All" />
|
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" PrivateAssets="All" />
|
||||||
</ItemGroup>
|
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.113"
|
||||||
<ItemGroup>
|
Condition=" '$(MachineRunAnalyzersDuringBuild)' != '' " />
|
||||||
<Compile Include="$(SolutionDir)Version/svnrev.cs" />
|
<Compile Include="$(SolutionDir)Version/svnrev.cs" />
|
||||||
<Compile Include="$(SolutionDir)Version/VersionInfo.cs" />
|
<Compile Include="$(SolutionDir)Version/VersionInfo.cs" />
|
||||||
<Compile Remove="Extensions/BinaryReaderExtensions.cs" />
|
<Compile Remove="Extensions/BinaryReaderExtensions.cs" />
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
<LangVersion>8.0</LangVersion>
|
<LangVersion>8.0</LangVersion>
|
||||||
<OutputPath>$(SolutionDir)output/dll</OutputPath>
|
<OutputPath>$(SolutionDir)output/dll</OutputPath>
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<RunAnalyzersDuringBuild Condition=" '$(MachineRunAnalyzersDuringBuild)' == '' ">false</RunAnalyzersDuringBuild>
|
||||||
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
@ -21,6 +23,5 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AdditionalFiles Include="$(SolutionDir).stylecop.json" />
|
<AdditionalFiles Include="$(SolutionDir).stylecop.json" />
|
||||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.113" PrivateAssets="All" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -14,7 +14,7 @@ for /f "usebackq tokens=*" %%A in (`vswhere -version "[16.0,17.0)" -requires Mic
|
||||||
IF "%MSBUILDPATH%"=="" GOTO MISSINGMSBUILD
|
IF "%MSBUILDPATH%"=="" GOTO MISSINGMSBUILD
|
||||||
|
|
||||||
nuget restore ..\BizHawk.sln
|
nuget restore ..\BizHawk.sln
|
||||||
call "%MSBUILDPATH%" ..\BizHawk.sln /p:Configuration=Release /p:Platform="Any Cpu" /t:rebuild
|
call "%MSBUILDPATH%" ..\BizHawk.sln "/p:Configuration=Release;Platform=AnyCPU;MachineRunAnalyzersDuringBuild=true" /t:rebuild
|
||||||
|
|
||||||
@if errorlevel 1 goto MSBUILDFAILED
|
@if errorlevel 1 goto MSBUILDFAILED
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue