https://download.csdn.net/download/aasmfox/87364042

修改setup.js

// Windows Template Library - WTL version 10.0
// Copyright (C) Microsoft Corporation, WTL Team. All rights reserved.
//
// This file is a part of the Windows Template Library.
// The use and distribution terms for this software are covered by the
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
// which can be found in the file MS-PL.txt at the root folder.// WTL App Wizard universal setup program for Visual Studio"use strict";main();function main()
{// Decode command line argumentsvar bDebug = false;var bElevated = false;var strVersion = "";var bCopyFiles = false;var Args = WScript.Arguments;for(var i = 0; i < Args.length; i++){if(Args(i) == "/debug")bDebug = true;else if(Args(i) == "/elevated")bElevated = true;else if(Args(i).substr(0, 5) == "/ver:")strVersion = Args(i).substr(5);else if(Args(i) == "/copyfiles")bCopyFiles = true;}// See if UAC is enabledvar Shell = WScript.CreateObject("Shell.Application");if(!bElevated && Shell.IsRestricted("System", "EnableLUA")){// Check that the script is being run interactively.if(!WScript.Interactive){WScript.Echo("ERROR: Elevation required.");return;}// Now relaunch the script, using the "RunAs" verb to elevatevar strParams = "\"" + WScript.ScriptFullName + "\"";if(bDebug)strParams += " /debug";if(strVersion)strParams += " /ver:" + strVersion;if(bCopyFiles)strParams += " /copyfiles";strParams += " /elevated";Shell.ShellExecute(WScript.FullName, strParams, null, "RunAs");return;}// Create shell objectvar WSShell = WScript.CreateObject("WScript.Shell");// Create file system objectvar FileSys = WScript.CreateObject("Scripting.FileSystemObject");// Get the folder containing the script filevar strValue = FileSys.GetParentFolderName(WScript.ScriptFullName);if(strValue == null || strValue == "")strValue = ".";var strSourceFolder = FileSys.BuildPath(strValue, "Files");if(bDebug)WScript.Echo("Source: " + strSourceFolder);if(!FileSys.FolderExists(strSourceFolder)){WScript.Echo("ERROR: Cannot find Wizard folder (should be: " + strSourceFolder + ")");return;}if(!strVersion)MessageBox(WSShell, "Setup will search for installed versions of Visual Studio,\nand ask to add the WTL App Wizard for each of them.");var strRegKey_32 = "HKLM\\Software\\";var strRegKey_64 = "HKLM\\Software\\Wow6432Node\\";// Search for Visual Studio 2005-2015var nVersions = 7;var astrRegKeyVer = new Array();astrRegKeyVer[0] = "Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir";astrRegKeyVer[1] = "Microsoft\\VisualStudio\\9.0\\Setup\\VC\\ProductDir";astrRegKeyVer[2] = "Microsoft\\VisualStudio\\10.0\\Setup\\VC\\ProductDir";astrRegKeyVer[3] = "Microsoft\\VisualStudio\\11.0\\Setup\\VC\\ProductDir";astrRegKeyVer[4] = "Microsoft\\VisualStudio\\12.0\\Setup\\VC\\ProductDir";astrRegKeyVer[5] = "Microsoft\\VisualStudio\\14.0\\Setup\\VC\\ProductDir";astrRegKeyVer[6] = "Microsoft\\VisualStudio\\SXS\\VS7\\16.0";var strWizardFolder = "vcprojects";var astrVersions = new Array();astrVersions[0] = "Visual Studio 2005 (8.0)";astrVersions[1] = "Visual Studio 2008 (9.0)";astrVersions[2] = "Visual Studio 2010 (10.0)";astrVersions[3] = "Visual Studio 2012 (11.0)";astrVersions[4] = "Visual Studio 2013 (12.0)";astrVersions[5] = "Visual Studio 2015 (14.0)";astrVersions[6] = "Visual Studio 2019 (16.0)";var astrWizVer = new Array();astrWizVer[0] = "8.0";astrWizVer[1] = "9.0";astrWizVer[2] = "10.0";astrWizVer[3] = "11.0";astrWizVer[4] = "12.0";astrWizVer[5] = "14.0";astrWizVer[5] = "16.0";var astrParamVer = new Array();astrParamVer[2] = "10";astrParamVer[3] = "11";astrParamVer[4] = "12";astrParamVer[5] = "14";astrParamVer[5] = "16";var nSpecial = 2;var bFound = false;for(var i = 0; i < nVersions; i++){if(strVersion && (strVersion != astrParamVer[i]))continue;if(bDebug)WScript.Echo("Looking for: " + astrVersions[i]);try{var strVCKey = strRegKey_32 + astrRegKeyVer[i];strValue = WSShell.RegRead(strVCKey);}catch(e){try{var strVCKey_x64 = strRegKey_64 + astrRegKeyVer[i];strValue = WSShell.RegRead(strVCKey_x64);}catch(e){continue;}}var strDestFolder = FileSys.BuildPath(strValue, strWizardFolder);if(bDebug)WScript.Echo("Destination: " + strDestFolder);if(!FileSys.FolderExists(strDestFolder))continue;if(i == nSpecial)   // special case for VS2010{var strCheckFile = FileSys.BuildPath(strDestFolder, "vc.vsdir");if(!FileSys.FileExists(strCheckFile))continue;}var strDataDestFolder = "";if(bCopyFiles){strDataDestFolder = FileSys.BuildPath(strValue, "VCWizards");if(bDebug)WScript.Echo("Data Destination: " + strDataDestFolder);if(!FileSys.FolderExists(strDataDestFolder))continue;strDataDestFolder = FileSys.BuildPath(strDataDestFolder, "AppWiz\\WTL");}bFound = true;var bRet = true;if(!strVersion){var strMsg = "Found: " + astrVersions[i] + "\n\nInstall WTL App Wizard?";bRet = MessageBox(WSShell, strMsg, true);}if(bRet){SetupWizard(WSShell, FileSys, strSourceFolder, strDestFolder, strDataDestFolder, astrWizVer[i], bDebug);}}// Search for Visual Studio 2017-2019var nVersionsNew = 2;var strWizardFolderNew = "Common7\\IDE\\VC\\vcprojects";var astrVersionsNew = new Array();astrVersionsNew[0] = "Visual Studio 2017 (15.0)";astrVersionsNew[1] = "Visual Studio 2019 (16.0)";var astrWizVerNew = new Array();astrWizVerNew[0] = "15.0";astrWizVerNew[1] = "16.0";var astrParamVerNew = new Array();astrParamVerNew[0] = "15";astrParamVerNew[1] = "16";var astrFilterVer = new Array();astrFilterVer[0] = "[15.0,16.0]";astrFilterVer[1] = "[16.0,17.0]";// Ensure that we can run vswhere.exevar strProgFileRegKey_x86 = "HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\ProgramFilesDir (x86)";var strProgFileRegKey = "HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\ProgramFilesDir";var strVSWFolder = "";try{strVSWFolder = WSShell.RegRead(strProgFileRegKey_x86);}catch(e){try{strVSWFolder = WSShell.RegRead(strProgFileRegKey);}catch(e){strVSWFolder = "";}}var strVSWFile = "";if(strVSWFolder){strVSWFile = FileSys.BuildPath(strVSWFolder, "Microsoft Visual Studio\\Installer\\vswhere.exe");if(!FileSys.FileExists(strVSWFile)){if(bDebug)WScript.Echo("ERROR: Cannot find vswhere.exe");strVSWFile = "";}}for(var j = 0; j < nVersionsNew; j++){if(!strVSWFile)continue;if(strVersion && (strVersion != astrParamVerNew[j]))continue;if(bDebug)WScript.Echo("Looking for: " + astrVersionsNew[j]);var TemporaryFolder = 2;var strTmpFolder = FileSys.GetSpecialFolder(TemporaryFolder);var strBatFile = FileSys.BuildPath(strTmpFolder, FileSys.GetTempName() + ".bat");if(bDebug)WScript.Echo("Temp batch file: " + strBatFile);var strLogFile = FileSys.BuildPath(strTmpFolder, FileSys.GetTempName());if(bDebug)WScript.Echo("Temp log file: " + strLogFile);try{var fileBat = FileSys.CreateTextFile(strBatFile);var strLine = "@\"" + strVSWFile + "\" -nologo -version " + astrFilterVer[j] + " -prerelease -property installationPath -format value > " + strLogFile;fileBat.WriteLine(strLine);fileBat.Close();WSShell.Run(strBatFile, 0, true);}catch(e){var strError = "no info";if(e.description.length != 0)strError = e.description;WScript.Echo("ERROR: Cannot create/use tmp batch file (" + strError + ")");continue;}try{var ForReading = 1;var fileLog = FileSys.OpenTextFile(strLogFile, ForReading);while(!fileLog.AtEndOfStream){var strLine = fileLog.ReadLine();var strDestFolder = FileSys.BuildPath(strLine, strWizardFolderNew);if(bDebug)WScript.Echo("Destination: " + strDestFolder);if(!FileSys.FolderExists(strDestFolder)){try{FileSys.CreateFolder(strDestFolder);}catch(e){}if(!FileSys.FolderExists(strDestFolder))continue;}var strDataDestFolder = "";if(bCopyFiles){strDataDestFolder = FileSys.BuildPath(strLine, "VCWizards");if(bDebug)WScript.Echo("Data Destination: " + strDataDestFolder);if(!FileSys.FolderExists(strDataDestFolder))continue;strDataDestFolder = FileSys.BuildPath(strDataDestFolder, "AppWiz\\WTL");}bFound = true;var bRet = true;if(!strVersion){var strMsg = "Found: " + astrVersionsNew[j] + "\nat: " + strLine + "\n\nInstall WTL App Wizard?";bRet = MessageBox(WSShell, strMsg, true);}if(bRet){SetupWizard(WSShell, FileSys, strSourceFolder, strDestFolder, strDataDestFolder, astrWizVerNew[j], bDebug);}}fileLog.Close();}catch(e){var strError = "no info";if(e.description.length != 0)strError = e.description;WScript.Echo("ERROR: Cannot read tmp file (" + strError + ")");}try{FileSys.DeleteFile(strBatFile);FileSys.DeleteFile(strLogFile);}catch(e){var strError = "no info";if(e.description.length != 0)strError = e.description;WScript.Echo("ERROR: Cannot delete tmp file (" + strError + ")");}}if(!strVersion){if(bFound)MessageBox(WSShell, "Done!");elseMessageBox(WSShell, "Setup could not find Visual Studio installed");}
}function MessageBox(WSShell, strText, bYesNo)
{var nType = bYesNo ? (4 + 32) : 0;   // 4 = Yes/No buttons, 32 = Questionmark icon, 0 = OK buttonvar nRetBtn = WSShell.Popup(strText, 0, "WTL App Wizard Setup", nType);return (nRetBtn == 6);   // 6 = Yes;
}function SetupWizard(WSShell, FileSys, strSourceFolder, strDestFolder, strDataDestFolder, strWizVer, bDebug)
{// Copy filestry{var strSrc = FileSys.BuildPath(strSourceFolder, "WTL10AppWiz.ico");var strDest = FileSys.BuildPath(strDestFolder, "WTL10AppWiz.ico");FileSys.CopyFile(strSrc, strDest);strSrc = FileSys.BuildPath(strSourceFolder, "WTL10AppWiz.vsdir");strDest = FileSys.BuildPath(strDestFolder, "WTL10AppWiz.vsdir");FileSys.CopyFile(strSrc, strDest);if(strDataDestFolder != "")FileSys.CopyFolder(strSourceFolder, strDataDestFolder, true);}catch(e){var strError = "no info";if(e.description.length != 0)strError = e.description;WScript.Echo("ERROR: Cannot copy file (" + strError + ")");return;}// Read and write WTL10AppWiz.vsz, add engine version and replace path when foundtry{var strSrc = FileSys.BuildPath(strSourceFolder, "WTL10AppWiz.vsz");var strDest = FileSys.BuildPath(strDestFolder, "WTL10AppWiz.vsz");var ForReading = 1;var fileSrc = FileSys.OpenTextFile(strSrc, ForReading);if(fileSrc == null){WScript.Echo("ERROR: Cannot open source file " + strSrc);return;}var ForWriting = 2;var fileDest = FileSys.OpenTextFile(strDest, ForWriting, true);if(fileDest == null){WScript.Echo("ERROR: Cannot open destination file" + strDest);return;}while(!fileSrc.AtEndOfStream){var strLine = fileSrc.ReadLine();if((strLine.indexOf("Wizard=VsWizard.VsWizardEngine") != -1)){strLine += "." + strWizVer;}else if(strLine.indexOf("WIZARD_VERSION") != -1){strLine = "Param=\"WIZARD_VERSION = " + strWizVer + "\"";}else if(strLine.indexOf("ABSOLUTE_PATH") != -1){if(strDataDestFolder == "")strLine = "Param=\"ABSOLUTE_PATH = " + strSourceFolder + "\"";elsestrLine = "Param=\"ABSOLUTE_PATH = " + strDataDestFolder + "\"";}fileDest.WriteLine(strLine);}fileSrc.Close();fileDest.Close();}catch(e){var strError = "no info";if(e.description.length != 0)strError = e.description;WScript.Echo("ERROR: Cannot read and write WTL10AppWiz.vsz (" + strError + ")");return;}// Create WTL foldervar strDestWTLFolder = "";try{strDestWTLFolder = FileSys.BuildPath(strDestFolder, "WTL");if(!FileSys.FolderExists(strDestWTLFolder))FileSys.CreateFolder(strDestWTLFolder);if(bDebug)WScript.Echo("WTL Folder: " + strDestWTLFolder);}catch(e){var strError = "no info";if(e.description.length != 0)strError = e.description;WScript.Echo("ERROR: Cannot create WTL folder (" + strError + ")");return;}// Read and write additional WTL10AppWiz.vsdir, add path to the wizard locationtry{var strSrc = FileSys.BuildPath(strSourceFolder, "WTL10AppWiz.vsdir");var strDest = FileSys.BuildPath(strDestWTLFolder, "WTL10AppWiz.vsdir");var ForReading = 1;var fileSrc = FileSys.OpenTextFile(strSrc, ForReading);if(fileSrc == null){WScript.Echo("ERROR: Cannot open source file " + strSrc);return;}var ForWriting = 2;var fileDest = FileSys.OpenTextFile(strDest, ForWriting, true);if(fileDest == null){WScript.Echo("ERROR: Cannot open destination file" + strDest);return;}while(!fileSrc.AtEndOfStream){var strLine = fileSrc.ReadLine();if(strLine.indexOf("WTL10AppWiz.vsz|") != -1)strLine = "..\\" + strLine;fileDest.WriteLine(strLine);}fileSrc.Close();fileDest.Close();}catch(e){var strError = "no info";if(e.description.length != 0)strError = e.description;WScript.Echo("ERROR: Cannot read and write WTL\\WTL10AppWiz.vsdir (" + strError + ")");return;}WScript.Echo("App Wizard successfully installed!");
}

修改注册表:

Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7]
"10.0"="B:\\VisualStudio\\VC2010\\"
"15.0"="B:\\VisualStudio\\VS2017\\"
"8.0"="B:\\VisualStudio\\VS2005\\"
"12.0"="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\"
@="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\"
"14.0"="B:\\VisualStudio\\VS2015\\"
"16.0"="B:\\VisualStudio\\VS2019\\"

VS2019配置WTL10.0相关推荐

  1. CREO5.0二次开发+VS2019配置详解

    CREO5.0+VS2019配置更新 一.CREO5.0 配置 二.Visual Studio 2019配置 新建MFC DLL项目 文件>新建>项目,选择MFC DLL,如下图所示 项目 ...

  2. 【opencv安装和配置完整版教程】(win10+vs2019+opencv4.4.0+opencv_contrib-4.4.0+永久配置)

    [opencv安装和配置](win10+vs2019+opencv4.4.0+opencv_contrib-4.4.0+永久配置) 下载vs2019 opencv4.4.0.opencv_contri ...

  3. vs2019使用openssl3.0的环境配置并进行DES加解密

    vs2019使用openssl3.0的环境配置并进行DES加/解密 1.环境配置 (1)在电脑上安装好vs2019,openssl3.0 (2)打开vs2019按一下步骤进行配置 右击项目--属性-- ...

  4. KinectV2.0 VS2019配置记录

    目录 OpenCV VS2019配置(更兼容的配置见下文) Kinect中基本的操作 兼容性较好的配置方法 基于pthread多线程实现与树莓派联动 上位机 上位机环境要求(配置inc.lib.dll ...

  5. VS2019配置opencv详细图文教程和测试代码

    摘要: vs2019新鲜出炉,配置opencv又有哪些不一样呢,这个教程将会一步一步的教你如何配置opencv和跑动opencv一个简单的项目. 测试代码请在原文找到,转发备注原文链接:https:/ ...

  6. vs2019配置opencv4.3

    看了网上很多教程,总是配置失败. 经过两天的奋战,总算是找到了一篇可以成功配置运行环境的教程: https://www.cnblogs.com/wbyixx/p/12238317.html 基于 VS ...

  7. 来自GPU的Hello World-基于Win10+VS2019+CUDA 11.0搭建CUDA编程环境

    序   CPU和GPU 当代计算机的两个核心,GPU计算与CPU计算的结合,使得原本的计算性能得到大幅度的提高,两者功能的互补性使得CPU+GPU的异构并行计算得到快速发展.为了支持使用CPU+GPU ...

  8. win10+vs2019配置lite.ai.toolkit预编译库

    目录 一.配置OpenCV 2. 解压安装包,双击安装包,指定解压缩目录 3.属性页会在后面一起配置 二.配置Onnxruntime 三.配置TNN 四.在VS2019下编译MNN 五.配置NCNN环 ...

  9. vs2019配置opencv,解决报错“无法打开源opencv2/opencv.hpp”

    目录 1,opencv下载地址 1.1 如何确定用什么版本的opencv opencv2和3的区别 opencv3和4的区别 1.2 source和exe 1.3 VC11.VC14.VC15库对应V ...

  10. Win10+vs2019配置与运行RenderMatch+用contextcapture进行重建

    Win10+vs2019配置与运行RenderMatch+用contextcapture进行重建 继上一篇博客,ground image 和aerial image影像匹配结果将会被保存为match. ...

最新文章

  1. Fragment提交transaction导致state loss异常
  2. 解决response响应乱码
  3. leetcode每日一题系列——881. 救生艇
  4. 最小化安装linux CentOS-6.6后 部署fastdfs +下载地址 很干很干的干货
  5. remo video repair中文版
  6. matlab清理程序onCleanup
  7. 更灵活的边缘云原生运维:OpenYurt 单元化部署新增 Patch 特性
  8. Python 神工具包!翻译、文字识别、语音转文字统统搞定
  9. thinkcell插件_PPT大神私藏的5款插件,用好它们,小白也能快速做出精美的PPT
  10. mysql 回表 覆盖索引_mysql 14 覆盖索引+回表
  11. sqlserver 导入mysql,在项目中迁移MS SQLServer到Mysql数据库,实现MySQL数据库的快速整合...
  12. 《手把手教你》系列基础篇之2-python+ selenium自动化测试-打开和关闭浏览器(详细)
  13. 使用struts中的DisPatchAction的时候需要用到的jar包
  14. python多次判断_python - 怎么判断函数或方法多次使用是否需要定义临时变量?
  15. 下载Cisco Packet Tracer 模拟器 含汉化教程
  16. bert中最大处理序列长度超过512的处理策略
  17. 程序设计实践-21点赌博游戏
  18. 告别硬编码,MySQL 如何实现按某字段的不同取值进行统计?
  19. carte集群的搭建笔记
  20. Opncv 实现拍照、颜色识别和阈值选取

热门文章

  1. Linux 0.11-shell 程序读取你的命令-43
  2. 张小七的C#语言笔记
  3. 强大如斯的Bunch类
  4. FreeRTOS移植Error: L6218E: Undefined symbol xTaskGetCurrentTaskHandle (referred from stream_buffer.o).
  5. Linux(Centos7) 报 “RTNETLINK answers: File exists” 问题的解决
  6. 消除Permission is only granted to system apps报错
  7. annot keep settings in the secure 或WRITE_SETTINGS not granted
  8. C#——初识Console
  9. html alert属性可以自定义,Html自定义alert,confirm弹窗
  10. ITSM系统_CMDB设计_业务要件