用于代码生成的Visual Studio自定义工具...我如何找出问题所在? [英] Visual Studio custom tool for code generation... how do I find out what's going wrong?

查看:105
本文介绍了用于代码生成的Visual Studio自定义工具...我如何找出问题所在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Visual Studio 2010中创建用于代码生成的自定义工具.首先我注册了它:

I'm trying to create a custom tool for code generation in Visual Studio 2010. First I register it:

"$(FrameworkSDKDir)Bin\NETFX 4.0 Tools\gacutil.exe" /if "$(TargetPath)"

然后我通过reg键添加它:

Then I add it via a reg key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CLSID\{6A96476E-74F3-4AB3-9CCA-F15EC6104D84}]
"RuntimeVersion"="v4.0.30319"
"Class"="MapBuildTool.MapFileGenerator"
"Assembly"="MapBuildTool, Version=1.0.0.0, Culture=en-US, PublicKeyToken=7d8abca94a1e38ae"
"ThreadingModel"="Both"
"InprocServer32"="C:\\Windows\\SysWOW64\\mscoree.dll"
@="MapBuildTool"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}\MapBuildTool]
"CLSID"="{6A96476E-74F3-4AB3-9CCA-F15EC6104D84}"
"GeneratesDesignTimeSource"=dword:00000001
@="MapBuildTool"

然后Visual Studio说:

And then visual studio says:

Cannot find custom tool 'MapBuildTool' on this system.

好吧...现在呢?找不到自定义工具注册表项吗?它找到钥匙了,但是在装配件时遇到了麻烦?它是否加载了程序集,但是无法实例化类...?我可以在哪里找到哪些日志/位置以找出问题所在?

OK... now what? Did it not find the custom tool registry key? Did it find the key but have trouble loading the assembly? Did it load the assembly but have trouble instantiating the class ...? What logs/places are there where I can look to find out what's wrong?

推荐答案

我遇到了一个我昨天写的自定义工具的问题.极其沮丧. reg文件是正确的,自定义工具在实验性"配置单元中运行完美.但是它只是拒绝在常规的VisualStudio中运行.

I ran into this issue with a custom-tool that I wrote yesterday. Extremely frustrating. The reg file was correct, the custom-tool ran perfectly in the Experimental Hive. But it simply refused to run in regular VisualStudio.

我猜想Visual Studio会读取注册表,然后将注册表部分缓存在某个地方.

I'm guessing that VisualStudio reads the registry and then caches pieces of the registry somewhere.

执行以下操作似乎会重置此缓存

Executing the following appear to reset this cache

devenv /setup

执行完此操作后,我的自定义工具运行完美.

After executing this, my custom-tool worked perfectly.

这篇关于用于代码生成的Visual Studio自定义工具...我如何找出问题所在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆