wms103006

Help.

I have the following in my AssemblyInfo.cs file:

[assembly: AssemblyKeyFile("mypubprivkey.snk")]

Every time I Run a Code Analysis -- Build/Run Code Analysis on my project it produces a warning:

Warning 1 Use command line option '/keyfile' or appropriate project settings instead of 'AssemblyKeyFile'

How do I resolve this warning I've tried several examples that I found online but get the same error or different errors.

Any ideas

Thanks.



Re: Visual C# Language keyfile instead of AssemblyKeyFile

rauhanlinnake

If you are using Visual Studio 2005, you can use Project Settings (right click project name in solution explorer) to sign the assembly.




Re: Visual C# Language keyfile instead of AssemblyKeyFile

wms103006

I did just that and still get the error.



Re: Visual C# Language keyfile instead of AssemblyKeyFile

David M. Kean - MSFT

This warning is not a Code Analysis warning, it is issue by the compiler so I'm moving this to C# language forum.




Re: Visual C# Language keyfile instead of AssemblyKeyFile

wms103006

that's fine; any ideas why the error occurs



Re: Visual C# Language keyfile instead of AssemblyKeyFile

frederikm

Hi

I had never noticed the warning before, but looked into some of the past builds and noticed that it had always been there. After doing some research, I found out that Visual Studio 2005 now considers the use of setting the AssemblyKeyFile in the AssemblyInfo.cs file a security issue. This is due to the AssemblyKeyFile attribute being embedded within your assembly and possibly containing sensitive path information. The warning also recommended setting this information via the project settings. I use an external strong name key file for all of my assemblies. It resides outside all of my projects/solutions. When I referenced this strong name key file, VS2005 copied it into the project. This wasn't a good thing at all.

http://dougrohm.com/cs/archive/2006/06/18/169.aspx

and the solution

http://davidkean.net/archive/2005/08/25/1162.aspx

Hope this helps you out, please close the thread if it does :)