CodeKicks.com
Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Monday, December 28, 2009

Error: type or namespace name 'AssemblyKeyFileAttribute' and 'AssemblyKeyFile' could not be found

To associate an assembly with a strong key file to store it to GAC, we use should include following line after all the imports and before defing namespace.

For VB.NET:  <Assembly: AssemblyKeyFile("c:\path\mykey.snk")>
For C#:    [assembly: AssemblyKeyFile(@"c:\path\mykey.snk")]

but, you might encounter following two errors at the time of creating Assembly for GAC.

1. The type or namespace name 'AssemblyKeyFileAttribute' could not be found (are you missing a using directive or an assembly reference?)

2. The type or namespace name 'AssemblyKeyFile' could not be found (are you missing a using directive or an assembly reference?)

How to resolve these errors: Just include "System.Reflection" namespace. It resolve above two errors.

Post a Comment