简体   繁体   中英

Building Visual Studio 2010 C++ project with a system that has only Visual Studio 2017 installed

We're currently upgrading our systems and want to use that opportunity to upgrade from VS 2010 to VS 2017.

Before switching over, we're running some tests with our existing projects (C++ and C#). Compiling and debugging C# projects worked - as expected - without a hitch.

We've got one pretty big C++ solution that we'd also like to continue developing in VS 2017, but for now we'd like to neither upgrade the platform toolset or sdk version.

Just installing VS 2017 and compiling the solution results in the error:

The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please install Visual Studio 2010 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".

While googling i've found the following question: How to install Visual Studio Build Tools 2010 on Visual Studio 2015 Community?

Which is similar to the problem we're facing. I tried installing the Headers and Tools from the Windows 7 SDK. I also installed the C++ Compiler Update, but now get the following errors (for every project):

  • Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. in C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\Microsoft.CppBuild.targets on line 297

  • Required file "" is missing. in C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\Platforms\\Win32\\Microsoft.Cpp.Win32.Targets on line 153

The element mentioned in above error has the following text:

<!-- 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)"
>

Looking for ways to solve the warning, that the WindowsSDKDir couldn't befound led me to this question

Chaning the Platform Toolset to "Windows7.1SDK" gets rid of the "Could not find WindowsSDKDir variable from the registry." error, but the "Required file "" is missing." error remains.

Installing Visual Studio 2010 C++ Express does solve the problem (at least for compiling and running the solution in Release).

Is there a way to work with VS 2017 and without upgrading our projects without needing to install VS 2010?

It is apparently not possible. You've got to either install Visual Studio 2010 or upgrade the toolset to Visual Studio 2017 as outlined in this blogpost - and comments .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM