【问题标题】:Building Visual Studio 2010 C++ project with a system that has only Visual Studio 2017 installed使用仅安装了 Visual Studio 2017 的系统构建 Visual Studio 2010 C++ 项目
【发布时间】:2019-07-02 14:20:02
【问题描述】:

我们目前正在升级我们的系统,并希望借此机会从 VS 2010 升级到 VS 2017。

在切换之前,我们正在对现有项目(C++ 和 C#)进行一些测试。编译和调试 C# 项目按预期工作,没有任何问题。

我们有一个相当大的 C++ 解决方案,我们还想在 VS 2017 中继续开发,但现在我们既不想升级平台工具集也不想升级 sdk 版本。

刚安装VS 2017并编译解决方案会报错:

找不到 Visual Studio 2010 的构建工具(平台工具集 = 'v100')。要使用 v100 构建工具进行构建,请安装 Visual Studio 2010 构建工具。或者,您可以通过选择“项目”菜单或右键单击解决方案,然后选择“重新定位解决方案”来升级到当前的 Visual Studio 工具。

在谷歌搜索时,我发现了以下问题:How to install Visual Studio Build Tools 2010 on Visual Studio 2015 Community?

这与我们面临的问题相似。我尝试从 Windows 7 SDK 安装标头和工具。我还安装了 C++ 编译器更新,但现在出现以下错误(对于每个项目):

  • 无法从注册表中找到 WindowsSDKDir 变量。 TargetFrameworkVersion 或 PlatformToolset 可能设置为无效的版本号。在第 297 行的 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets 中

  • 缺少必需的文件“”。在 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets 第 153 行

上述错误中提到的元素有以下文字:

<!-- Rest of the sources -->
<CL Condition="'%(ClCompile.PrecompiledHeader)' != 'Create' and '%(ClCompile.ExcludedFromBuild)'!='true'"
    BuildingInIDE                      ="$(BuildingInsideVisualStudio)"
    Sources                            ="@(ClCompile)"

    AdditionalIncludeDirectories       ="%(ClCompile.AdditionalIncludeDirectories)"
    AdditionalOptions                  ="%(ClCompile.AdditionalOptions)"
    AdditionalUsingDirectories         ="%(ClCompile.AdditionalUsingDirectories)"
    AssemblerListingLocation           ="%(ClCompile.AssemblerListingLocation)"
    AssemblerOutput                    ="%(ClCompile.AssemblerOutput)"
    BasicRuntimeChecks                 ="%(ClCompile.BasicRuntimeChecks)"
    BrowseInformation                  ="%(ClCompile.BrowseInformation)"
    BrowseInformationFile              ="%(ClCompile.BrowseInformationFile)"
    BufferSecurityCheck                ="%(ClCompile.BufferSecurityCheck)"
    CallingConvention                  ="%(ClCompile.CallingConvention)"
    CompileAsManaged                   ="%(ClCompile.CompileAsManaged)"
    CompileAs                          ="%(ClCompile.CompileAs)"
    DebugInformationFormat             ="%(ClCompile.DebugInformationFormat)"
    DisableLanguageExtensions          ="%(ClCompile.DisableLanguageExtensions)"
    DisableSpecificWarnings            ="%(ClCompile.DisableSpecificWarnings)"
    EnableEnhancedInstructionSet       ="%(ClCompile.EnableEnhancedInstructionSet)"
    EnableFiberSafeOptimizations       ="%(ClCompile.EnableFiberSafeOptimizations)"
    EnablePREfast                      ="%(ClCompile.EnablePREfast)"
    ErrorReporting                     ="%(ClCompile.ErrorReporting)"
    ExceptionHandling                  ="%(ClCompile.ExceptionHandling)"
    ExcludedInputPaths                 ="$(ExcludePath)"
    ExpandAttributedSource             ="%(ClCompile.ExpandAttributedSource)"
    FavorSizeOrSpeed                   ="%(ClCompile.FavorSizeOrSpeed)"
    FloatingPointExceptions            ="%(ClCompile.FloatingPointExceptions)"
    FloatingPointModel                 ="%(ClCompile.FloatingPointModel)"
    ForceConformanceInForLoopScope     ="%(ClCompile.ForceConformanceInForLoopScope)"
    ForcedIncludeFiles                 ="%(ClCompile.ForcedIncludeFiles)"
    ForcedUsingFiles                   ="%(ClCompile.ForcedUsingFiles)"
    FunctionLevelLinking               ="%(ClCompile.FunctionLevelLinking)"
    GenerateXMLDocumentationFiles      ="%(ClCompile.GenerateXMLDocumentationFiles)"
    IgnoreStandardIncludePath          ="%(ClCompile.IgnoreStandardIncludePath)"
    InlineFunctionExpansion            ="%(ClCompile.InlineFunctionExpansion)"
    IntrinsicFunctions                 ="%(ClCompile.IntrinsicFunctions)"
    MinimalRebuild                     ="%(ClCompile.MinimalRebuild)"
    MultiProcessorCompilation          ="%(ClCompile.MultiProcessorCompilation)"
    ObjectFileName                     ="%(ClCompile.ObjectFileName)"
    OmitDefaultLibName                 ="%(ClCompile.OmitDefaultLibName)"
    OmitFramePointers                  ="%(ClCompile.OmitFramePointers)"
    OpenMPSupport                      ="%(ClCompile.OpenMPSupport)"
    Optimization                       ="%(ClCompile.Optimization)"
    PrecompiledHeader                  ="%(ClCompile.PrecompiledHeader)"
    PrecompiledHeaderFile              ="%(ClCompile.PrecompiledHeaderFile)"
    PrecompiledHeaderOutputFile        ="%(ClCompile.PrecompiledHeaderOutputFile)"
    PreprocessKeepComments             ="%(ClCompile.PreprocessKeepComments)"
    PreprocessorDefinitions            ="%(ClCompile.PreprocessorDefinitions)"
    PreprocessSuppressLineNumbers      ="%(ClCompile.PreprocessSuppressLineNumbers)"
    PreprocessToFile                   ="%(ClCompile.PreprocessToFile)"
    ProcessorNumber                    ="%(ClCompile.ProcessorNumber)"
    ProgramDataBaseFileName            ="%(ClCompile.ProgramDataBaseFileName)"
    RuntimeLibrary                     ="%(ClCompile.RuntimeLibrary)"
    RuntimeTypeInfo                    ="%(ClCompile.RuntimeTypeInfo)"
    ShowIncludes                       ="%(ClCompile.ShowIncludes)"
    SmallerTypeCheck                   ="%(ClCompile.SmallerTypeCheck)"
    StringPooling                      ="%(ClCompile.StringPooling)"
    StructMemberAlignment              ="%(ClCompile.StructMemberAlignment)"
    SuppressStartupBanner              ="%(ClCompile.SuppressStartupBanner)"
    TreatSpecificWarningsAsErrors      ="%(ClCompile.TreatSpecificWarningsAsErrors)"
    TreatWarningAsError                ="%(ClCompile.TreatWarningAsError)"
    TreatWChar_tAsBuiltInType          ="%(ClCompile.TreatWChar_tAsBuiltInType)"
    UndefineAllPreprocessorDefinitions ="%(ClCompile.UndefineAllPreprocessorDefinitions)"
    UndefinePreprocessorDefinitions    ="%(ClCompile.UndefinePreprocessorDefinitions)"
    UseFullPaths                       ="%(ClCompile.UseFullPaths)"
    UseUnicodeForAssemblerListing      ="%(ClCompile.UseUnicodeForAssemblerListing)"
    WarningLevel                       ="%(ClCompile.WarningLevel)"
    WholeProgramOptimization           ="%(ClCompile.WholeProgramOptimization)"
    XMLDocumentationFileName           ="%(ClCompile.XMLDocumentationFileName)"
    CreateHotpatchableImage            ="%(CLCompile.CreateHotpatchableImage)"

    TrackerLogDirectory                ="%(ClCompile.TrackerLogDirectory)"

    TLogReadFiles                      ="@(CLTLogReadFiles)"
    TLogWriteFiles                     ="@(CLTLogWriteFiles)"
    ToolExe                            ="$(CLToolExe)"
    ToolPath                           ="$(CLToolPath)"
    TrackFileAccess                    ="$(TrackFileAccess)"
    MinimalRebuildFromTracking         ="%(ClCompile.MinimalRebuildFromTracking)"
    ToolArchitecture                   ="$(CLToolArchitecture)"
    TrackerFrameworkPath               ="$(CLTrackerFrameworkPath)"
    TrackerSdkPath                     ="$(CLTrackerSdkPath)"
    TrackedInputFilesToIgnore      ="@(ClNoDependencies)"

    AcceptableNonZeroExitCodes         ="%(ClCompile.AcceptableNonZeroExitCodes)"
    YieldDuringToolExecution           ="$(ClYieldDuringToolExecution)"
>

寻找解决警告的方法,找不到 WindowsSDKDir 导致我到this question

将平台工具集更改为“Windows7.1SDK”可以消除“无法从注册表中找到 WindowsSDKDir 变量”。错误,但缺少“必需文件”。错误仍然存​​在。

安装 Visual Studio 2010 C++ Express 确实解决了这个问题(至少对于在 Release 中编译和运行解决方案)。

有没有一种方法可以使用 VS 2017 并且无需升级我们的项目而无需安装 VS 2010?

【问题讨论】:

    标签: c++ visual-studio visual-studio-2010 visual-studio-2017


    【解决方案1】:

    这显然是不可能的。您必须安装 Visual Studio 2010 或将工具集升级到 Visual Studio 2017 as outlined in this blogpost - and comments

    【讨论】:

      猜你喜欢
      • 2011-04-08
      • 1970-01-01
      • 2018-06-02
      • 2017-04-02
      • 2017-08-07
      • 2021-08-03
      • 2018-04-15
      • 2016-10-09
      • 2011-02-13
      相关资源
      最近更新 更多