VS2012 中未找到的 EnvDTE 在 VS2010 中有效 [英] EnvDTE not found in VS2012 works in VS2010

查看:26
本文介绍了VS2012 中未找到的 EnvDTE 在 VS2010 中有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 EnvDTE 在我的 T4 模板中生成一些代码.

I'm using EnvDTE to do some code generation within my T4 Templates.

我的代码在 Visual Studio 2010 中正常工作,但是我刚刚开始使用 Visual Studio 2012,现在当我尝试运行我的模板时出现以下错误

I have the code working correctly in Visual Studio 2010, however I've just started using Visual Studio 2012 and now when I try to run my templates I get the following error

Compiling transformation: Metadata file 'EnvDTE.dll' could not be found 

我的项目中实际上没有对 EnvDTE 的引用,因为它是 Silverlight 类库,我无法添加 DLL,但它以某种方式找到了 DLL.

I don't actually have a reference to EnvDTE in my project as its a Silverlight class library and I wasn't able to add the DLL, however it finds the DLL somehow.

我不确定 10 和 12 之间的区别是什么导致了这种情况.

I'm not sure what is difference is between 10 and 12 to cause this.

以下是我的 ttinclude 文件开头的导入和程序集定义.

The following are my imports and assembly definitions from the start of my ttinclude file.

<#@ template debug="true" hostSpecific="true" #>
<#@ output extension=".generated.cs" #>
<#@ Assembly Name="EnvDTE.dll" #>
<#@ Assembly Name="System.Data" #>
<#@ import namespace="EnvDTE" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.Data.SqlClient" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Text.RegularExpressions" #>

有什么我必须做的不同才能让它适用于 Visual Studio 2012

Is there anything I have to do differently to get it working for Visual Studio 2012

推荐答案

看来 VS12 无法弄清楚 EnvDTE 在哪里.奇怪的是(正如您在评论中提到的)融合没有发现这一点.也许确实如此,但您没有正确阅读?

It appears that VS12 can't figure out where EnvDTE is. Its odd that (as you mentioned in a comment) fusion didn't pick that up. Perhaps it did, but you weren't reading it correctly?

顺便说一句,当融合日志让你失望时,当你无法弄清楚为什么应用程序找不到应该存在的东西时,是时候打破进程监视器了.

As an aside, when the fusion log lets you down, its time to break out Process Monitor when you can't figure out why an application can't find something that should be there.

您可以在 T4 模板中提供程序集引用的完整路径.在你的情况下,它会

You can give a full path for assembly references in T4 templates. In your case, it would be

<#@ Assembly Name="C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\PublicAssemblies\envdte.dll" #>

(假设您在正确的位置安装了 EnvDTE).我不会认为这是一个真正的解决方案,并且会就此向 MS 提出一个 Connect 问题.好像是个bug.

(assuming you have EnvDTE in the correct spot). I wouldn't consider this a true solution, and would open a Connect issue with MS about this. Seems like a bug.

这篇关于VS2012 中未找到的 EnvDTE 在 VS2010 中有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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