加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

VS2010 command prompt gives error : Cannot determine the location of the VS Common Tools folder

(2015-10-23 04:49:40)
标签:

it

vs2012

注册表

环境变量

安装目录

分类: 电脑
装好Visual Studio 2012,打开它的命令行,有时会遇到如下错误
Cannot determine the location of the VS Common Tools folderhttp://s12/bmiddle/001MKziZgy6WpUqLNdF7b&690command prompt gives error Cannot determine the location of the VS Common Tools folder" TITLE="VS2010 command prompt gives error Cannot determine the location of the VS Common Tools folder" />


你google,你bing,你得到的答案基本上都是说你没有把C:\Windows\System32 加入到Path环境变量里,因为它用到了reg命令。

打开文件 C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\vcvars32.bat

第86行,

@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "11.0"') DO (
@if "%%i"=="11.0" (
@SET "VS110COMNTOOLS=%%k"
)
)

我们发现它是自行搜索注册表,找到VisualStudio的安装目录,然后设置VS110COMNTOOLS环境变量。 但是如果注册表被禁止了呢? 即使reg命令可以找到,但无法打开注册表,那么
VS110COMNTOOLS就会被设置为空,继而引发错误
Cannot determine the location of the VS Common Tools folder

可做如下实验:
1. 打开  gpedit.msc, User Configuration, Administrativee Templateds, System, 找到Prevent access to registry editing tools, 
http://s15/bmiddle/001MKziZgy6WpVkepGKae&690command prompt gives error Cannot determine the location of the VS Common Tools folder" TITLE="VS2010 command prompt gives error Cannot determine the location of the VS Common Tools folder" />
双击,选成 Enabled
http://s1/bmiddle/001MKziZgy6WpVpuPdKe0&690command prompt gives error Cannot determine the location of the VS Common Tools folder" TITLE="VS2010 command prompt gives error Cannot determine the location of the VS Common Tools folder" />

这时你就可以重现Cannot determine the location of the VS Common Tools folder错误了。

总结:
Cannot determine the location of the VS Common Tools folder的原因:

1) C:\Windows\System32  没有被加入Path变量里
2) 注册表被禁了

如何解禁注册表

1)gpedit.msc, User Configuration, Administrativee Templateds, System, 找到Prevent access to registry editing tools, Disabled

2) 如果1)不通的话,Symantec提供了一个小工具
https://www.symantec.com/security_response/writeup.jsp?docid=2004-050614-0532-99

以上方法适用于visual studio其他版本。

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有