26.02.2015 Views

C#.Net Migration - A2Z Dotnet

C#.Net Migration - A2Z Dotnet

C#.Net Migration - A2Z Dotnet

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Generating Strong Named Assembly<br />

• A strong named assembly must have:<br />

– Name, version, culture and public key token<br />

– By default culture is “neutral”, which is a valid value if not specified<br />

• Steps involved<br />

– Add Key attributes to your code<br />

• AssemblyVersion<br />

• AssemblyKeyFile<br />

– Generate key file with “sn.exe –k mykey.snk”<br />

– Compile code<br />

using System;<br />

using System.Reflection;<br />

[assembly: AssemblyVersion("1.0.0.0")]<br />

[assembly: AssemblyDelaySign(false)]<br />

[assembly: AssemblyKeyFile("..\\..\\mykey.snk")]<br />

class TheLibrary{<br />

public void Method1()<br />

{<br />

//implementation<br />

}<br />

}<br />

Version number<br />

Assembly key file<br />

generated with sn.exe<br />

tool<br />

52

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!