首页 > 解决方案 > 不能多次应用属性“TargetFrameworkAttribute”

问题描述

构建时在 .net Web 应用程序上出现错误。

\obj\Debug.NETFramework,Version=v4.7.2.AssemblyAttributes.vb(7,14):错误 BC30663:不能多次应用属性“TargetFrameworkAttribute”。

' <autogenerated/>
        Option Strict Off
        Option Explicit On

        Imports System
        Imports System.Reflection
        <Assembly: Global.System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName:=".NET Framework 4.7.2")>

我已经搜索了解决方案,没有重复。我还删除了 bin 和 obj 文件夹并重新启动 - 这没有任何效果。

标签: asp.net.net

解决方案


进入 Visual Studio 项目的 AssemblyInfo 文件并注释掉重复属性的组装行。

要查看 AssemblyInfo 文件,可能需要在 Visual Studio 的解决方案资源管理器中启用“显示所有文件”选项。

对我来说,“ComVisible 属性是在 AssemblyInfo 文件和 Class 文件中指定的。在 AssemblyInfo 文件中将此属性注释掉后,此错误就消失了。


推荐阅读