Visual Studio不断重建并破坏智能

时间:2019-06-18 07:08:14

标签: c++ cmake visual-studio-2017 intellisense rebuild

问题

1)Visual Studio不断重建每个项目,而不管对源代码所做的更改。 2)Intellisense也坏了。每个命令都会出现错误,提示“没有其他可用信息” 3)Visual Studio指出尽管成功构建了项目,但E1696仍然无法打开源文件“ CURRENTLYOPENSOURCEFILEINCAPS.CPP”。错误图标不同于导致构建失败的错误。

我做了什么

我已启用诊断输出。对于零检查cmake目标,它无法找到我检查过的generate.stamp.rule,它在构建之前就已经存在,并且没有被删除和重新生成,并且文件路径正确。各个项目都有类似的文件,但是Visual Studio说它们丢失了。

我已经遍历了很多堆栈溢出文章,以使智能感知再次发挥作用,但是没有任何效果。使用解决方案资源管理器打开时,所有文件在导航栏中都有“(全局作用域),该位置以前是文件路径。

我已经使用msbuild进行构建,它说“正在创建“ x64 \ Debug \ ZERO_CHECK \ ZERO_CHECK.tlog \ unsuccessfulbuild”,因为指定了“ AlwaysCreate”。我不知道为什么要指定AlwaysCreate。我已经读到,如果#include试图包含不存在的东西但我不知道它如何编译,则可能会发生这种情况-无论如何,这是一个很大的代码库,并且如果这一定是导致原因的原因以前的提交在没有问题的地方应该解决它,但是没有。

我没有源代码构建,因此我尝试删除它并重新CMak所有内容,以便清除所有缓存变量。

我尝试将所有设置重置为出厂设置。

我已禁用并发构建。

我已经在管理员模式下运行。

我已经删除了存储库中的所有内容,并建立了输出,然后在发生这种情况之前重新克隆并签出了以前的提交。

我尝试将源代码复制到另一个驱动器上,并在该驱动器上以不同的文件夹深度进行复制。

我尝试两次卸载并重新安装Visual Studio。

可以确认创建新的虚拟项目没有列出的3个问题。

我尝试了以下操作的组合:删除所有内容,重置vs,重新安装vs,克隆先前的工作提交,cmaking,build vs in admin,building  与管理员相比,它仍然有所有3个问题。

诊断输出中的第一个故障点

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.

不是。

在决定/执行AlwaysCreate事情之前,会有更多输出

>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".

1 个答案:

答案 0 :(得分:0)

问题显然是由Windows狡猾的区分大小写的实现引起的。

背景 我在各种linux / windows平台上工作,因此当我读到有关Windows区分大小写的信息时,我很兴奋,并在大约两周前尝试了一下。在启用repo文件夹的区分大小写功能后,cmake不再能够找到编译器,而且我没有时间弄清楚原因,因此我将其切换回去。我使用的命令不是递归命令,因此我必须禁用所有启用的文件夹,因此仍然存在区分大小写的情况。

解决了我的问题的步骤:

  1. 以管理员模式运行Windows Powershell
  2. fsutil.exe file setCaseSensitiveInfo C:\folder disable
  3. 在从驱动器到最深源代码文件的每个目录级别上重复。

应该有一个递归标志或类似的东西,但是如果不是这样的话,那么很容易在powershell中循环浏览文件夹,但是我现在不担心语法正确。

more info on windows case sensitivity here