diff --git a/src/Integration.Vsix/CFamily/VcxProject/FileConfig.cs b/src/Integration.Vsix/CFamily/VcxProject/FileConfig.cs index 93e11de61..1285eb00a 100644 --- a/src/Integration.Vsix/CFamily/VcxProject/FileConfig.cs +++ b/src/Integration.Vsix/CFamily/VcxProject/FileConfig.cs @@ -46,7 +46,8 @@ public static FileConfig TryGet(ILogger logger, ProjectItem dteProjectItem, stri return null; } - CmdBuilder cmdBuilder = new CmdBuilder(vcFile.ItemType == "ClInclude"); + var isHeader = vcFile.ItemType == "ClInclude"; + CmdBuilder cmdBuilder = new CmdBuilder(isHeader); var compilerPath = vcConfig.GetEvaluatedPropertyValue("ClCompilerPath"); if (string.IsNullOrEmpty(compilerPath)) @@ -75,7 +76,9 @@ public static FileConfig TryGet(ILogger logger, ProjectItem dteProjectItem, stri { CDDirectory = Path.GetDirectoryName(vcProject.ProjectFile), CDCommand = cmdBuilder.GetFullCmd(), - CDFile = absoluteFilePath, + // A hack to communicate with the CFamily analyzer that this is a header file. + // A long-term solution should be investigated in CPP-5898. + CDFile = isHeader ? "non_existent_file" : absoluteFilePath, EnvInclude = envINCLUDE, }; }