解决 VS2022 .NET 7 项目中的 T4 模版无法引用其他程序集的问题
搜索 devenv.exe.config 文件.
一般在 C:\Program Files\Microsoft Visual Studio\2022\*\Common7\IDE\devenv.exe.config
修改无效的话再修改AppData下的
C:\Users\*\AppData\Local\Microsoft\VisualStudio\17.0_*\devenv.exe.config
在这个XML中的 assemblyBinding (configuration -> runtime -> assemblyBinding) 中添加
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>
来源 https://stackoverflow.com/questions/51550265/
发布 94zl.com