Karlitos2312
Karlitos2312

Reputation: 97

Attribute 'TargetFrameworkAttribute' cannot be applied multiple times

Getting an error on a .net webapplication when building.

\obj\Debug.NETFramework,Version=v4.7.2.AssemblyAttributes.vb(7,14): error BC30663: Attribute 'TargetFrameworkAttribute' cannot be applied multiple times.

' <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")>

I have searched the solution and there is no duplicates. I have also deleted the bin and obj folder and restarted - that has had no effect.

Upvotes: 2

Views: 7899

Answers (1)

JohnH
JohnH

Reputation: 2133

Go into the AssemblyInfo file for your Visual Studio project and comment out the Assembly line of the duplicated attribute.

To see the AssemblyInfo file, the "Show All Files" option may need to be enabled in the Solution Explorer of Visual Studio.

For me, the "ComVisible attribute was specified in the AssemblyInfo file and in a Class file. After this attribute was commented out in the AssemblyInfo file, this error went away.

Upvotes: 2

Related Questions