CppStandard does not work with plugins?

I’m using C++17, this setting works in main project, but does not work in plugin. Am I doing something wrong?

    CppStandard = CppStandardVersion.Cpp17;

1>D:\dev\ue4\AIM\Polygon4\Plugins\DBTool\Intermediate\Build\Win64\UE4Editor\Development\DBTool\Module.DBTool.cpp : error C2855: command-line option ‘/std:c++’ inconsistent with precompiled header
1>D:\dev\primitives\src\filesystem\include\primitives/filesystem.h(17): error C2039: ‘filesystem’: is not a member of ‘std’
1> C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\INCLUDE\experimental/filesystem(30): note: see declaration of ‘std’

The problem is that PCH was created without c++17 option. /Yu"D:\dev\ue4\AIM\Polygon4\Intermediate\Build\Win64\Polygon4Editor\Development\UnrealEd\SharedPCH.UnrealEd.h"

How do I pass it there?

Ok, solved with

PCHUsage = PCHUsageMode.NoSharedPCHs;

Where should I add this line? In Plugin build.cs, in project target.cs? When I add it in plugin build.cs file I still get errors saying that c++17 types aren’t members of std:: namespace. I also get a warning saying that as of 4.21 modules must explicitly mention PCH(s).

I am trying to build a UE4.22 Plugin against the c++17 (specifically trying to use std::variant). I have set CppStandard to in the project target.cs file
“CppStandard = CppStandardVersion.Cpp17;” and in the plugin build.cs file I have set PCHUsage as you have stated. When I attempt to build after doing both a clean and a ./GenerateProjectFiles.sh I still get errors about there not being a template named variant in namespace std. Also, I have BuildEnvironment set to TargetBuildEnvironment.Unique. I’m not sure if that is relevant or not. What else would I need to do in order to build UE 4.22 plugins against c++17 standard?

I put it here: https://github.com/aimrebirth/Polygon4/blob/master/Plugins/DBTool/Source/DBTool/DBTool.Build.cs#L76

Try to clean up everything (Intermediate folder) and then re-run.