VS 2012 is unable to locate envdte.dll from T4 template file - by Tobi_B

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 776194 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 1/9/2013 10:58:39 PM
Access Restriction Public


We are currently evaluating the upgrade from VS 2010 to VS 2012 as we require features from .Net framework 4.5. During this evaluation I just stumbled upon the issue that VS 2012 is unable to locate the envdte.dll from within a T4 template file.

This will fail:
<#@ Assembly Name="envdte.dll" #>
with the error: Compiling transformation: Metadatafile 'envdte.dll' could not be found

To resolve the issue we currently have to specify the full path to the envdte.dll so this will work:
<#@ Assembly Name="C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\PublicAssemblies\envdte.dll" #>

Although a possible workaround is available, it should not be necessary to specify the full path to the dll and should, in my opinion, be considered a bug and treated as such.

Kind regards,

Sign in to post a comment.
Posted by Pedro.Rainho on 12/12/2013 at 5:34 AM
Doing this<#@ assembly name="envdte" #>, doesn't work, here is the output of the T4

C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /t:library /utf8output /R:"System.dll" /R:"System.Xml.dll" /R:"EnvDTE" /R:"C:\USERS\J10337\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\11.0\EXTENSIONS\TQMYVYTL.OTC\Shark.Tools.SharkFactory.v3.dll" /R:"C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\bdkiasz3.rj2\Microsoft.Practices.RecipeFramework.VisualStudio.Library.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.11.0\v4.0_11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.11.0.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.Interfaces.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll" /out:"C:\Users\j10337\AppData\Local\Temp\czkarmhx.dll" /D:DEBUG /debug+ /optimize- /w:4 "C:\Users\j10337\AppData\Local\Temp\czkarmhx.0.cs"

Microsoft (R) Visual C# Compiler version 4.0.30319.17929

for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.

error CS0006: Metadata file 'EnvDTE' could not be found
Posted by Microsoft on 1/25/2013 at 11:46 AM
Thanks for you feedback. To make this work remove the .dll from envdte. When you specify the extension, T4 thinks you want a fully qualified path. If you change your attribute to <#@ assembly name="envdte" #>, it will work.
Posted by Microsoft on 1/15/2013 at 1:15 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Macy [MSFT] on 1/9/2013 at 11:15 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)