Is there a way to sign partial classes in Whidbey?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to make strong name for may apllication assemblies, but I don't know
where and how can I do it in Whidbey.

Help me please
 
Check out this link ( copy and paste it )
in the Whidbey documentation:

ms-help://MS.VSCC.v80/MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxadvance/html/2c30799a-a826-46b4-a25d-c584027a6c67.htm

Essentially, there are two ways to sign an assembly with a strong name:

1. Using the Assembly Linker (Al.exe) provided by the .NET Framework SDK.

2. Using assembly attributes to insert the strong name information in your
code.

You can use either the AssemblyKeyFileAttribute
or the AssemblyKeyNameAttribute, depending on
where the key file to be used is located.

You must have a cryptographic key pair
to sign an assembly with a strong name.

This public and private cryptographic key pair is used
during compilation to create a strong-named assembly.

You can create a key pair using the Strong Name tool (Sn.exe).
Key pair files usually have an .snk extension.

To get info about creating a cryptographic key pair, see :

ms-help://MS.VSCC.v80/MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxadvance/html/05026813-f3bd-4d7c-9e0b-fc588eb3d114.htm

in your Whidbey documentation



Juan T. Llibre
ASP.NET MVP
===========
 
Hi, Juan!

Have you tried to do it yourself in Whidbey project ?

Including in my code like this

using System;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.Xml.Xsl;
using Microsoft.ApplicationBlocks.Data;
using System.Reflection;

[assembly: AssemblyKeyFileAttribute(@"..\..\sn.snk")]

public partial class Log_aspx
{
.......

(key file lies in root of project folder)

I have an error:
"Error 1 S1548: Cryptographic failure while signing assembly
'c:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\Temporary ASP.NET
Files\stockexchangew\ae722549\e2e2fb71\virkegir.dll' -- 'Error reading key
file '..\..\sn.snk' -- The system cannot find the file specified. "
"Error 2 Warning as Error: Use command line option '/keyfile' or appropriate
project settings instead of
'AssemblyKeyFileAttribute' F:\StockExchange\Log.aspx.cs 10 11

What should I do?
 
Hi, Vadim.

re Error 1:
Check your .snk directory path.

Re Error 2:
You need to set the AssemblyKeyFile attribute:
[assembly: AssemblyKeyFile(".\\keyFile.snk")]

Additionally : Are you also setting the DelaySignAttribute ?
[assembly: AssemblyDelaySign(true)]
[assembly: AssemblyKeyFile(".\\keyFile.snk")]
or
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile(".\\keyFile.snk")]

What I would recommend is that you
send this question to the C# newsgroup :
microsoft.public.dotnet.languages.csharp

You're far more likely to get specialized expert help there.




Juan T. Llibre
ASP.NET MVP
===========
Vadim said:
Hi, Juan!

Have you tried to do it yourself in Whidbey project ?

Including in my code like this

using System;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.Xml.Xsl;
using Microsoft.ApplicationBlocks.Data;
using System.Reflection;

[assembly: AssemblyKeyFileAttribute(@"..\..\sn.snk")]

public partial class Log_aspx
{
......

(key file lies in root of project folder)

I have an error:
"Error 1 S1548: Cryptographic failure while signing assembly
'c:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\Temporary ASP.NET
Files\stockexchangew\ae722549\e2e2fb71\virkegir.dll' -- 'Error reading key
file '..\..\sn.snk' -- The system cannot find the file specified. "
"Error 2 Warning as Error: Use command line option '/keyfile' or
appropriate
project settings instead of
'AssemblyKeyFileAttribute' F:\StockExchange\Log.aspx.cs 10 11

What should I do?

Juan T. Llibre said:
Check out this link ( copy and paste it )
in the Whidbey documentation:

ms-help://MS.VSCC.v80/MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxadvance/html/2c30799a-a826-46b4-a25d-c584027a6c67.htm

Essentially, there are two ways to sign an assembly with a strong name:

1. Using the Assembly Linker (Al.exe) provided by the .NET Framework SDK.

2. Using assembly attributes to insert the strong name information in
your
code.

You can use either the AssemblyKeyFileAttribute
or the AssemblyKeyNameAttribute, depending on
where the key file to be used is located.

You must have a cryptographic key pair
to sign an assembly with a strong name.

This public and private cryptographic key pair is used
during compilation to create a strong-named assembly.

You can create a key pair using the Strong Name tool (Sn.exe).
Key pair files usually have an .snk extension.

To get info about creating a cryptographic key pair, see :

ms-help://MS.VSCC.v80/MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxadvance/html/05026813-f3bd-4d7c-9e0b-fc588eb3d114.htm

in your Whidbey documentation



Juan T. Llibre
ASP.NET MVP
===========
 
Back
Top