T4MVC“运行自定义工具”生成 EnvDTO 7.0 与 8.0 csc 警告

发布于 2024-11-26 10:47:26 字数 387 浏览 4 评论 0原文

当我右键单击 T4MVC.tt 并选择“运行自定义工具”(即通过 T4MVC.cs 文件重建)时,我收到以下警告。

警告1 编译转换:假设程序集引用 'EnvDTE, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 匹配“EnvDTE,版本=8.0.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a”, 您可能需要提供运行时策略 C:\Development\EHealth-Trunk\src\EHealth.Web\T4MVC.tt 1 1

这真的没什么大不了的,我只是不喜欢在我的代码库中出现(不必要的)警告......

I'm getting the following warning when I right click on T4MVC.tt and select "run custom tool" (i.e. rebuild by T4MVC.cs file).

Warning 1
Compiling transformation: Assuming assembly reference 'EnvDTE, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
matches 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a',
you may need to supply runtime policy
C:\Development\EHealth-Trunk\src\EHealth.Web\T4MVC.tt 1 1

It's no big deal really, I just don't like to have (unnecessary) warnings in my code-base...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如梦亦如幻 2024-12-03 10:47:26

我还没有完全弄清楚问题是什么,但我确实将其隔离到发生这种情况的一个小重现中:

<#@ template language="C#" #>
<#@ assembly name="EnvDTE" #>
<#@ assembly name="VSLangProj" #>

<#+ 
void Test(EnvDTE.Project Project) {
    var vsProject = (VSLangProj.VSProject)Project.Object;
    var refs = vsProject.References;
}
#>

在处理过程中收到以下警告:

Compiling transformation: Assuming assembly reference 'EnvDTE, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' matches 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a', you may need to supply runtime policy

我的 GAC 中唯一的 EnvDTE 是 8.0.0.0。看来问题与 VSLangProj 7.0.3300.0(我唯一的)引用了 EnvDTE 7.0.3300.0 这一事实有关,而该引用并不存在。

显然,这还不是一个“答案”,但这是调查的开始:)

I haven't quite figured out what the problem is, but I did isolate it to a small repro where this happens:

<#@ template language="C#" #>
<#@ assembly name="EnvDTE" #>
<#@ assembly name="VSLangProj" #>

<#+ 
void Test(EnvDTE.Project Project) {
    var vsProject = (VSLangProj.VSProject)Project.Object;
    var refs = vsProject.References;
}
#>

Which gets the following warning during processing:

Compiling transformation: Assuming assembly reference 'EnvDTE, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' matches 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a', you may need to supply runtime policy

The only EnvDTE in my GAC is 8.0.0.0. It seems that the problem relates to the fact that VSLangProj 7.0.3300.0 (the only one I have) has a reference to EnvDTE 7.0.3300.0, which doesn’t exist.

Clearly, this is not an 'answer' quite yet, but it's the beginning of the investigation :)

东京女 2024-12-03 10:47:26

改变:

<#@程序集名称=“EnvDTE”#>

到:

<#@ 程序集名称=“EnvDTE,版本=8.0.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a”#>

在 T4MVC.tt 中,它将删除编译器警告:)

David - 我将很快提交一个包含 MvcContrib 修复程序的拉取请求 - 在我这样做之前让我知道您对该解决方案感到满意:)

Change:

<#@ assembly name="EnvDTE" #>

To:

<#@ assembly name="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" #>

in T4MVC.tt and it will remove the compiler warning :)

David - I'm going to submit a pull request with the fix to MvcContrib soon - just let me know that you are happy with that solution before I do it :)

迷路的信 2024-12-03 10:47:26

添加 app.config 并粘贴以下代码:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50318">
        <dependentAssembly>
            <assemblyIdentity name="EnvDTE" publicKeyToken=
            "b03f5f7f11d50a3a"/>
            <bindingRedirect oldVersion="7.0.3300.0" 
            newVersion="8.0.0.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

Add app.config and paste this code below:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50318">
        <dependentAssembly>
            <assemblyIdentity name="EnvDTE" publicKeyToken=
            "b03f5f7f11d50a3a"/>
            <bindingRedirect oldVersion="7.0.3300.0" 
            newVersion="8.0.0.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文