C# Error CS1725 – Friend assembly reference ‘{0}’ is invalid. InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified.

C# Error

CS1725 – Friend assembly reference ‘{0}’ is invalid. InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified.

Reason for the Error & Solution

Friend assembly reference ‘reference’ is invalid. InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified.

You cannot add a version culture in a friend assembly reference. Partial classes should be visible to friend assemblies.

Example

The following sample generates CS1725.

// CS1725.cs  
// compile with: /target:library  
using System.Runtime.CompilerServices;  
[assembly:InternalsVisibleTo("partial01,version=1.1.0.0")]   // CS1725  
// try the following line instead  
// [assembly:InternalsVisibleTo("partial01")]  
  
partial class TestClass
{  
   public static string strBar = "my string";  
}  

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

C# Compiler Error CS0442 – ‘Property’: abstract properties cannot have private accessors Reason for the Error You’ll get this error...
This is a really simple one . Below is a simple example of an enum called “Designation” defined with the...
This blog post explain the usage of the Checked Block in .NET and how you can use them in Visual...