Search code examples
c++windowsvisual-studiodockercommand-line

how to disable /Qspectre using Visual Studio 2019 Developer Command Prompt


I tried to google it but couldn't find it. I want to Disable /Qspectre from command line.

Note: I am trying this inside docker container i have already installed component for it.But still i am getting error MSB8040: Spectre-mitigated libraries are required for this project.So i want to disable it and give try. if it works.

docker run -v C:\BuildTools\ConsoleApplication1:C:\ConsoleApplication1 --name CP3 buildtools2019 msbuild C:\ConsoleApplication1\ConsoleApplication1.sln -maxcpucount:3 /p:Configuration=Debug /p:Platform=x64

This is PowerShell command which i am using it to run my project. open for all suggestion and recommendation.


Solution

  • I am afraid there is no direct command line method to disable /Qspectre. I suggest that you could disable it by some other methods.

    Put/copy file with name 'Directory.Build.props' to build folder with content:

    <Project>
      <PropertyGroup Label="Configuration">
        <SpectreMitigation>false</SpectreMitigation>
      </PropertyGroup>
    </Project>
    

    That overrides default VS behavior and disables /QSpectre compiler switch.

    You could refer to this link.