2011-08-30 8 views
1

MSBuildスクリプトでEF.Utility.CS.ttincludeを参照する.ttファイルを変換する際に問題が発生しています。EF.Utility.CS.ttincludeとMSBuild

VS2010内から世代を実行するとうまくいきますが、カスタムビルドスクリプトをコマンドライン経由で実行したときに発生します。

TextTransform "C:\SourceControl\SVN\PathToFile\myttFile.tt" 
C:\SourceControl\SVN\PathToFile\myttFile.tt(9,4): error : There was an error loading the include file 'EF.Utility.CS.ttinclude'. The transformation will not be run. The following Exception was thrown: [C:\SourceControl\SVN\PathToBuildScript\build.xml] 
    System.IO.FileNotFoundException: Could not find file 'C:\SourceControl\SVN\PathToFile\EF.Utility.CS.ttinclude'. 
    File name: 'C:\SourceControl\SVN\PathToFile\EF.Utility.CS.ttinclude' 
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 
    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) 
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) 
    at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) 
    at System.IO.StreamReader..ctor(String path) 
    at Microsoft.VisualStudio.TextTemplating.CommandLine.CommandLineHost.ReadFileContent(String fileName) 
    at Microsoft.VisualStudio.TextTemplating.CommandLine.CommandLineHost.LoadIncludeText(String requestFileName, String& content, String& location) 
    at Microsoft.VisualStudio.TextTemplating.Engine.ProcessIncludeDirective(Directive directive, ITextTemplatingEngineHost host) 
C:\SourceControl\SVN\PathToBuildScript\build.xml(30,5): error MSB3073: The command "TextTransform "C:\SourceControl\SVN\PathToFile\myttFile.tt"" exited with code 1. 

私はEF.Utility.CS.ttincludeの絶対パスを参照する場合、私が手:

TextTransform "C:\SourceControl\SVN\PathToFile\myttFile.tt" 
EXEC : error : An expression block evaluated as Null [C:\SourceControl\SVN\PathToBuildFile\build.xml] 
    at Microsoft.VisualStudio.TextTemplating.ToStringHelper.ToStringWithCulture(Object objectToConvert) 
    at Microsoft.VisualStudio.TextTemplatinga265b58e2b114039856ebd504775f376.GeneratedTextTransformation.TransformText() in c:\SourceControl\SVN\PathToFile\myttFile.tt:line 77 
    at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result) 
C:\SourceControl\SVN\PathToBuildFile\build.xml(30,5): error MSB3073: The command "TextTransform "C:\SourceControl\SVN\PathToFile\myttFile.tt"" exited with code 1. 

すべてのヘルプは素晴らしい:)

+2

あなたは-Iスイッチでtexttransform.exeを呼び出す試行しましたが、 EF.Utility.CS.ttincludeへのパス? パスは可能性があります: C:\ Program Files \ MicrosoftビジュアルStudio 10.0 \ Common7 \ IDE \拡張\マイクロソフト\ Entity Frameworkのツールはテンプレート\が含ま\ \ または C:\プログラムファイル(x86の)\ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ Extensions \ Microsoft \ Entity Framework Tools \ Templates \ Includes \ – Mir

答えて

0

だろうが、テンプレートは、あなたがしたことが表示されますmyttFile.ttを実行すると、テンプレートが実行された結果、何も出力されませんでしたTransformText();

ロジックがmyttFile.ttの内側に何も表示されないと、実際にはそれほど多くのことを伝えることはできません。

あなたは

が<#テンプレートのデバッグ=真#>

および追加 System.Diagnostics.Debugger.Launchを設定した場合、Visual Studioの11(); をテンプレートのコードセクションに追加すると、VS 11がデバッガを起動し、t4をデバッグできます。

申し訳ありませんが、私にちょうど始まりました。あなたのテンプレートは、そのホストとしてのVisual Studioに依存している可能性があります。あなたのテンプレートのどこかにhostspecific = trueがあります。要するに

<#@テンプレートhostspecific = "true" を言語= "C#" #>

1

:そうのように、この問題を解決するためにTextTransform.exeで-Iフラグを追加します。

ステップ1 : enter image description here

変数VS140COMNTXTTRANSFORMを作成します番目: はそうのように含めますTextTransformのEF6に環境変数のマッピングを作成します。 そのようTextTransform.exeコマンドで-Iフラグを含める:Windowsは

ステップ2が理解で

TextTransform.exe -I "%VS140COMNTXTTRANSFORM%" -out filename.tt 
+0

他のソリューションは動作しませんが – RezaRahmati