T4 文件中缺少 namespace/assembly 个错误

Missing namespace/assembly errors in T4 files

我在 T4 文件中使用 this microsoft's translator api code 时遇到问题。

我无法克服

type or namespace does not exist in 'System' (are you missing an assembly reference ?)

在 T4 文件中使用 System.ServiceModel 时出现错误消息。

我有几个名称空间未被识别。例如,System.ServiceModel.

我确实添加了:

无果。

还能做什么?

T4 模板只导入 System.ServiceModel 命名空间,它不引用 System.ServiceModel 程序集。它缺少汇编指令。

<#@ assembly name="System.ServiceModel" #>