0
T4를 통해 일부 코드를 생성하려고하는데 < # @ template language = "VBv3.5"# 지시어를 포함하면 다음 오류가 발생합니다. 주형.ProcessBemplate 메서드를 호출 할 때 VBV3.5 지시문 throw 오류가 포함됨
VBC : 명령 줄 (0,0) : 오류 BC2006 : '필요 옵션'R ': 변환을 Compinling (file_list를)
내가 < #를 @ 템플릿 언어 = "C#을 V3.5"를 사용하는 경우 #> 내 지시어로 잘 작동합니다. 또한 코드를 통해 생성하지 않고 .tt 파일을 저장하려고 시도하지 않으면 VBv3.5 지시문을 사용하여 올바르게 작동합니다.
여기 내 t4 템플릿입니다.
<#@ output extension="txt" #>
<#@ assembly name="Microsoft.SqlServer.ConnectionInfo" #>
<#@ assembly name="Microsoft.SqlServer.Smo" #>
<#@ assembly name="System.Configuration" #>
<#@ assembly name="Microsoft.VisualBasic" #>
hello world
여기 내 .NET 코드
Dim host As CustomCmdLineHost = New CustomCmdLineHost()
Dim engine As Engine = New Engine()
host.TemplateFileValue = sTemplateFile
'Read the text template.
Dim input As String = File.ReadAllText(sTemplateFile)
'Transform the text template.
Dim output As String = engine.ProcessTemplate(input, host)
응답 해 주셔서 감사합니다. 나는 T4 튜토리얼을 사랑한다. Visual Studio에서 .tt 파일을 저장할 때 잘 작동하도록 할 수 있습니다 (표준 T4 호스트에서 가정 한 내용이라고 가정하고 있습니까?). VBv3.5 지시문을 포함하고 CustomCmdLineHost를 전달하는 동안 ProcessTemplate 메서드를 실행하면 폭탄이 터집니다. VBv3.5 지시문을 제거하거나 C# v3.5로 전환하면 모든 것이 잘 동작합니다. – vonfeldj