问题显示:

Error 6
Compiling transformation: 'Microsoft.VisualStudio.TextTemplatingBED07DAE3B6FD53FA947017E5A5F7A123173F8AEEBD8059AD94FFEA4200EC409BE022035F5E3463EFD6E2867E0DEFBDC09BAEEE8B986A775611AFBBB7D110480.GeneratedTextTransformation' does not contain a definition for 'Host'
and no extension method 'Host' accepting a first argument of type 'Microsoft.VisualStudio.TextTemplatingBED07DAE3B6FD53FA947017E5A5F7A123173F8AEEBD8059AD94FFEA4200EC409BE022035F5E3463EFD6E2867E0DEFBDC09BAEEE8B986A775611AFBBB7D110480.GeneratedTextTransformation'
could be found (are you missing a using directive or an assembly reference?)
e:\Projects\XYX\XYX.Server\MarketDataModuleClientInterface\api.helper.tt
24 50
IMarketDataModuleClientlLibrary

其实问题很简单:

<#@ template hostspecific="true" language="C#" #>
<#@ output extension=".txt" #>
<#@ import namespace="System.CodeDom.Compiler" #>
<#
string message = "test message";
this.Host.LogErrors(new CompilerErrorCollection()
{ new CompilerError(
this.Host.TemplateFile, // Identify the source of the error.
0, 0, "0", // Line, column, error ID.
message) }); // Message displayed in error window.
#>

注意第一行: hostspecific="true"

如果是 false就会出现最前面的那个错误

Template Code 无法使用 this.Host 报错的更多相关文章

  1. Django_重装系统后无法使用 sqlite 数据库报错:com.intellij.execution.ExecutionException: Exception in thread "main" java.lang.ClassNotFoundException: org.sqlite.JDBC

     重装系统后无法使用 sqlite 数据库报错 报错 : com.intellij.execution.ExecutionException: Exception in thread "ma ...

  2. vs code调试console程序报错--preLaunchTask“build”

    网上有其他大神给出的建议是注释掉launch.json中的 "preLaunchTask": "build", 但是这种方式也会造成一个问题,就是再使用F5调试 ...

  3. django.template.exceptions.TemplateDoesNotExist: login.html报错

    前言 在某一次按以前的步骤使用Django    “django.template.exceptions.TemplateDoesNotExist: login.html”错误,在以为是html文件出 ...

  4. Code::Blocks20.03 编译报错

    Code::Blocks最近出了新版20.03,进入官网选择下载了附带MinGW版的安装包后,编译HelloWorld就报错(CB一直以来都有问题,新版还是这样...) 主要有两个问题: ld.exe ...

  5. Visual Studio Code 使用 Git插件报错 - Permission denied (publickey)

    在使用GitHub的时候,为了避免每次输入用户名密码,都会使用SSH方式代替Https. 按网上教程,大多数使用SSH-KeyGen生成公私钥对,而后上传公钥至Github,并切换Repositori ...

  6. 使用Visual Studio Code调试React Native报错

    报错信息: [Error] Error: Unknown error: not all success patterns were matched. It means that "react ...

  7. 'Error Domain=NSURLErrorDomain Code=-999' AFNetworking请求报错

    早上请求app请求登录接口发现了下面的错误信息: Error Domain=NSURLErrorDomain Code=-999 "已取消" UserInfo={NSErrorFa ...

  8. python3 无法使用flask.ext.* 报错的解决方法

    python3 使用flask的一些扩展功能的导入方法是 from flask_bootstrap import Bootstrapfrom flask_moment import Momentfro ...

  9. 执行opatch apply 报错 OPatch failed with error code 73

    .执行opatch apply 报错 OPatch failed [oracle@ora_11g 14275605]$ /opt/oracle/product/db_1/OPatch/opatch a ...

随机推荐

  1. Solidworks如何标注垂直度,平行度

    1 标注一个基准特征,放到一个平面的线上即可,比如下图生成了一个基准面A   2 点击形位公差,设置形位公差的符号,公差值,相对基准面(主要那一栏),然后不要点确定,直接在图上点击某个面,就生成一个形 ...

  2. 【分享】利用Apache的Htaccess Files命令限制訪问文件类型,Files正则

    假设你在你的模板目录中有非常多PSD HTML模板,那么用接下来这个htaccess文件能够保护限制訪问: 文件D:\WebSite\ZBPHP.COM\www\Tpl\.htaccess 所有源代码 ...

  3. 实现多线程的方式Runnable

    package com.thread.runnable; /** * 实现多线程的方式有继承Thread类和实现Runnable接口两种方式 * 哪种方式更好呢?实现的方式由于继承的方式. * 原因: ...

  4. cin,和几个get函数的用法

    1.cin.get(字符变量名):用来接收字符 ch = cin.get(); cin.get(ch); 以上两者均可以 2.cin.get(字符数组名,接收字符数目)用来接收一行字符串,可以接收空格 ...

  5. OO的片段,继承与组合,继承的优点与目的,虚机制在构造函数中不工作

    摘自C++编程思想: ------------------------------ 继承与组合:接口的重用 ------------------------------- 继承和组合都允许由已存在的类 ...

  6. linux网络配置及IP绑定

    在学习时,参考了这篇文章:http://blog.csdn.net/collection4u/article/details/14127671:在这篇文章中作者讲述了VMware中虚机的三种网络模式: ...

  7. C语言一个单链表的实现

    -- 所谓链表记住一句即可:地址不连续,大家只是握个手而已: list0.c #include<stdio.h> #include<malloc.h> typedef int ...

  8. !important的用法(IE6 兼容的解决方法)

    我们知道,CSS写在不同的地方有不同的优先级, .css文件中的定义 < 元素style中的属性,但是如果使用!important,事情就会变得不一样. 首先,先看下面一段代码: <!DO ...

  9. POJ3278 Catch That Cow —— BFS

    题目链接:http://poj.org/problem?id=3278 Catch That Cow Time Limit: 2000MS   Memory Limit: 65536K Total S ...

  10. Elasticsearch分布式安装启动失败

    配置config目录下的 elasticsearch.yml  http.cors.enabled: true http.cors.allow-origin: "*" #分布安装. ...