我需要指定我的 T4 使用 C# 4.0 来渲染我的 tt 文件吗?我尝试使用:
但是当我使用一个动态变量,像这样:
我遇到了以下这些错误:
<#@ template language="C#v4.0" debug="true" #>
但是当我使用一个动态变量,像这样:
dynamic x=10;
Write(x.ToString());
我遇到了以下这些错误:
Error 2 Compiling transformation: Predefined type 'Microsoft.CSharp.RuntimeBinder.CSharpSetMemberBinder' is not defined or imported e:\projects\DynamicModel\DynamicModel\ModelGenerator.tt 1 1
Error 3 Compiling transformation: Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpInvokeMemberBinder..ctor' e:\projects\DynamicModel\DynamicModel\ModelGenerator.tt 1 1
Error 4 Compiling transformation: Missing compiler required member 'System.Runtime.CompilerServices.CallSite.Create' e:\projects\DynamicModel\DynamicModel\ModelGenerator.tt 1 1
Error 5 Compiling transformation: One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll? e:\Projects\DynamicModel\DynamicModel\ModelGenerator.tt 7 8
Error 6 A namespace cannot directly contain members such as fields or methods e:\projects\DynamicModel\DynamicModel\ModelGenerator.cs 1 1 DynamicModel
另外,请注意我正在使用TextTemplatingFileGenerator,而不是预处理器模板。