Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 2013 T4安装VS2013更新3后包含指令中断_Visual Studio 2013_Include_T4 - Fatal编程技术网

Visual studio 2013 T4安装VS2013更新3后包含指令中断

Visual studio 2013 T4安装VS2013更新3后包含指令中断,visual-studio-2013,include,t4,Visual Studio 2013,Include,T4,更新到Visual Studio 2013 Update 3后,T4模板中的以下代码将中断 <#@ include file="../File1.tt" #> 此问题是否有任何已知的解决方法或修复方法?找到了根本原因 在实现接口时,要实现的方法之一是: public bool LoadIncludeText( string requestFileName, out string content, out string location) 在VS2013

更新到Visual Studio 2013 Update 3后,T4模板中的以下代码将中断

<#@ include file="../File1.tt" #>
此问题是否有任何已知的解决方法或修复方法?

找到了根本原因

在实现接口时,要实现的方法之一是:

public bool LoadIncludeText(
              string requestFileName, out string content, out string location)
VS2013 Update 3之前的所有早期版本中,不需要在
位置
参数中返回有效的文件名作为输出。事实上,我们发送
string.Empty

相应地,如果模板不是基于文件系统的,则该值可以为空。见文件参考:

位置类型:字符串
一个字符串,其中包含 获得的文本。如果主机在注册表中搜索 包括文件,或者如果主机默认搜索多个位置, 主机可以返回此文件中包含文件的最终路径 参数如果文件可以,主机可以将位置设置为空 找不到,或者如果主机不是基于文件系统的

但是,在更新3中,某些内容发生了更改,T4引擎检查并期望
location
参数为非空文件路径<代码>字符串。空值导致原始注释异常

作为临时解决方法:在实现
ITextTemplateEngineHost
时,将有效的文件名传递给方法
LoadIncludeText
上的
位置
参数可以避免异常

多亏了我在寻找虫子


更新:微软确认了错误。它将在更新4时修复。注释的解决方法有效。

我刚刚在Visual Studio 2013 Express(桌面)更新3中尝试了此方法。我无法复制这个。希望这只是您的安装中的一个问题。您是否在特殊的文化中运行?在
es
OS机器中使用VS的
en us
locale。使用Visual Studio 2013 Ultimate在两台机器上复制。卸载更新3可解决此问题。此外,我们有一份关于en-us VS+en-us操作系统的相同问题的报告。我和我的同事遇到了相同的问题。我们没有在代码中实现此方法。你能告诉我是否还有其他解决办法吗?不,据我所知@naomi。你能提供更多关于你的用例的细节吗?如果是另一种情况,请打开一个新问题。在我们的情况下,它在这一行失败,因此,为了绕过错误,我们将这些包含文件的文本包含到主tt文件中。更新4今天发布。Naomi:问微软的负责人,他们确认更新4中包含了修复程序。
There was an error loading the include file '..\\File1.tt'. The transformation will not    be run. The following Exception was thrown:
System.ArgumentException: The path is not of a legal form.
  at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
  at System.IO.Path.GetFullPathInternal(String path)
  at System.IO.Path.GetFullPath(String path)
  at Microsoft.VisualStudio.TextTemplating.Engine.VisitedFiles.Visit(String fileLocation)
  at Microsoft.VisualStudio.TextTemplating.Engine.ProcessIncludeDirective(Directive directive, ITextTemplatingEngineHost host, VisitedFiles includedFiles) in line: 234 in file: C:\...\mytemplate.tt
public bool LoadIncludeText(
              string requestFileName, out string content, out string location)