c++cmakevisual-studio-2017intellisenserebuild

Visual studio constantly rebuilding and intellisense broken


The problem

1) Visual studio constantly rebuilds every project regardless of changes made to source code. 2) Intellisense is also broken. Every command errors with "No additional information available" 3) Visual studio says there is an error E1696 cannot open source file "CURRENTLYOPENSOURCEFILEINCAPS.CPP" despite building the project successfully anyway. The error icon is different to errors that cause the build to fail.

What I've done

I've enabled diagnostic output. For the zero-check cmake target it fails to find a generate.stamp.rule which I've checked does exist prior to build and is not being deleted and regenerated and the file path is correct. Individual projects all have similar files that exist but visual studio says they are missing.

I've gone through many stack overflow posts to get intellisense going again but nothing is working. All files when opened using solution explorer have "(Global Scope) in the navigation bar where there used to be a filepath.

I've built using msbuild and it says "Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified." I don't know why AlwaysCreate is being specified. I've read that this can happen if #include tries to include things that don't exist but I don't understand how it can compile - in any case, this is a large code base and if this was the cause surely checking out previous commits where this was not a problem should fix it - but didn't.

I've got an out of source build so I've tried deleting it and re-CMaking everything so all cache variables are cleared.

I've tried resetting every setting to factory settings.

I've disabled concurrent builds.

I've run in administrator mode.

I've deleted everything in my repository and build outputs and re-cloned and checked out past commits before this was happening.

I've tried copying source code to another drive and at different levels of folder depth on the drive.

I've tried uninstalling and reinstalling visual studio twice.

Can confirm creating new dummy projects does not have any of the 3 listed problems.

I've tried a combination of deleting everything, resetting vs, reinstalling vs, cloning previously working commit, cmaking, building vs in admin, building vs in admin and still it has all 3 issues.

First point of failure in diagnostic output

1>------ Up-To-Date check: Project: ZERO_CHECK.vcxproj, Configuration: Debug x64 ------
1>Project is not up-to-date: build input 'e:\blabla\blabuilddir\cmakefiles\66f04b81c84059a8a3158e97cbfec9b8\generate.stamp.rule' is missing.

It is not.

Some more output prior to deciding/doing the AlwaysCreate thing

>Done building target "_HandlePackageFileConflicts" in project "ALL_BUILD.vcxproj".
16>Target "ResolveAssemblyReferences" in file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets":
16>  Added Item(s): 
16>      _ReferenceInstalledAssemblyDirectory=
16>          C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0
16>          C:\Program Files (x86)\Windows Kits\10\References
16>  Set Property: ResolveAssemblyReferencesStateFile=x64\Debug\ALL_BUILD\ALL_BUILD.vcxprojAssemblyReference.cache
16>  Set Property: ResolveAssemblyReferencesSilent=false
16>  Set Property: ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch=Warning
16>  Set Property: FindDependenciesOfExternallyResolvedReferences=false
16>  Task "ResolveAssemblyReference" skipped, due to false condition; ('@(Reference)'!='' or '@(_ResolvedProjectReferencePaths)'!='' or '@(_ExplicitReference)' != '') was evaluated as (''!='' or ''!='' or '' != '').
16>Done building target "ResolveAssemblyReferences" in project "ALL_BUILD.vcxproj".
16>Target "GenerateBindingRedirects" skipped, due to false condition; ('$(AutoGenerateBindingRedirects)' == 'true' and '$(GenerateBindingRedirectsOutputType)' == 'true') was evaluated as ('' == 'true' and 'true' == 'true').
16>Target "_RemoveZipFileSuggestedRedirect" skipped, due to false condition; ('$(_TargetFrameworkVersionWithoutV)' >= '4.7.1' And '$(AllowZipFileRedirect)' != 'true') was evaluated as ('4.0' >= '4.7.1' And '' != 'true').
16>Target "GenerateBindingRedirectsUpdateAppConfig" skipped, due to false condition; ('$(AutoGenerateBindingRedirects)' == 'true' and '$(GenerateBindingRedirectsOutputType)' == 'true' and Exists('$(_GenerateBindingRedirectsIntermediateAppConfig)')) was evaluated as ('' == 'true' and 'true' == 'true' and Exists('x64\Debug\ALL_BUILD\ALL_BUILD.config')).
16>Target "ResolveComReferences" skipped, due to false condition; ('@(COMReference)'!='' or '@(COMFileReference)'!='') was evaluated as (''!='' or ''!='').
16>Target "AfterResolveReferences" in file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets":
16>Done building target "AfterResolveReferences" in project "ALL_BUILD.vcxproj".
16>Target "ImplicitlyExpandDesignTimeFacades" skipped, due to false condition; ('$(ImplicitlyExpandDesignTimeFacades)' == 'true') was evaluated as ('' == 'true').
16>Target "ResolveTestReferences" skipped, due to false condition; ('@(Shadow)'!='') was evaluated as (''!='').
16>Target "ResolveReferences" in file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets":
16>Done building target "ResolveReferences" in project "ALL_BUILD.vcxproj".
16>Target "PrepareForBuild" skipped. Previously built successfully.
16>Target "PrepareForBuild" skipped. Previously built successfully.
16>Target "InitializeBuildStatus" in file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets":
16>  Task "ReadLinesFromFile"
16>    Task Parameter:File=x64\Debug\ALL_BUILD\ALL_BUILD.tlog\ALL_BUILD.lastbuildstate
16>    Output Item(s): 
16>        _ReadProjectStateLine=
16>            #TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0
16>            Debug|x64|E:\blaWork\bla\blaBuild-win64-vc15\|
16>  Done executing task "ReadLinesFromFile".
16>  Set Property: ProjectStateLine=#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0
16>  Set Property: StateBuildType=Build
16>  Task "WriteLinesToFile"
16>    Task Parameter:Overwrite=True
16>    Task Parameter:File=x64\Debug\ALL_BUILD\ALL_BUILD.tlog\ALL_BUILD.lastbuildstate
16>    Task Parameter:
16>        Lines=
16>            #TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0
16>            Debug|x64|E:\blaWork\bla\blabuild-win64-vc15\|
16>  Done executing task "WriteLinesToFile".
16>  Task "Touch"
16>    Task Parameter:AlwaysCreate=True
16>    Task Parameter:Files=x64\Debug\ALL_BUILD\ALL_BUILD.tlog\unsuccessfulbuild
16>    Touching "x64\Debug\ALL_BUILD\ALL_BUILD.tlog\unsuccessfulbuild".
16>  Done executing task "Touch".
16>Done building target "InitializeBuildStatus" in project "ALL_BUILD.vcxproj".

Solution

  • The problem was apparently caused by windows dodgy implementation of case sensitivity.

    background I work across various linux/windows platforms so when I read about windows case sensitivity I got excited and tried it out about two weeks ago. cmake could no longer find the compiler after I enabled case sensitivity on the repo folder and I didn't have time to figure out why so I switched it back. The command I used was not recursive so I must not have disabled all the folders that I enabled, so there was still some case sensitivity going on.

    Steps that solved my problem:

    1. run windows powershell in administrator mode
    2. fsutil.exe file setCaseSensitiveInfo C:\folder disable
    3. Repeat on every directory level from the drive to the deepest source code file.

    There should be a recursive flag or something but if not it's pretty easy to loop through folders in powershell but I can't be bothered getting the syntax correct right now.

    more info on windows case sensitivity here