Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / September 2005

Tip: Looking for answers? Try searching our database.

strong name using al.exe and csc.exe

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Danny Cooper - 01 Sep 2005 15:37 GMT
I'm very much a beginner with C# and the .NET Framework environment,
and am writing and building C# programs using the command line CSC.EXE
compiler. What I'm trying to do now is try out some of the evidence
options and the security policy settings.

Code Signing and using this via certificates and Publish evidence is
working fine, but I'm a bit stumped by strong naming at the moment.

I've created a key pair using sn.exe, and read that I sign with this
to an assembly before it's built (so not to a completed .exe).

This seems to be the way to go from what I've read:
AL.EXE /out:testapp.exe testapp.netmodule /keyfile:keypair.snk

So far I've been using /target:winexe in CSC.EXE, so don't have the
module files AL.EXE wants. I tried changing the CSC.EXE command line
to:
CSC.EXE /target.module /reference:... testapp.cs

This allowed AL.EXE to complete without error messages, but the
resulting .EXE says it's not a valid Win32 executable.

Can anyone point me in the right direction to getting a valid Win32
executable that is strong named, using only the command line tools of
the SDK?

Danny.
Bennie Haelen - 01 Sep 2005 17:52 GMT
Hi:

This should work:

1. Create your source file (e.ge. testApp.cs)
2. Create your keypair:
     sn -k keypair.snk
3. Compile your source file into a .NET Module:
     csc /target:module testApp.cs
   this will create a file called testApp.netmodule
4. Use the assembly linker to create the .exe:
     al /target:exe /out:testApp.exe /main:MyNamespace.testapp.Main
        /keyfile:keypair.snk testApp.netmodule

   Notice here that you should use the correct fully qualified name for
your main method: <NameSpace>.<className>.<MethodName>

Hope this helps,

Bennie Haelen

> I'm very much a beginner with C# and the .NET Framework environment,
> and am writing and building C# programs using the command line CSC.EXE
[quoted text clipped - 23 lines]
>
> Danny.
Danny Cooper - 02 Sep 2005 12:01 GMT
Excellent, yes that did it - except it didn't want the name space part
in the /main option.

Many thanks.

>Hi:
>
[quoted text clipped - 44 lines]
>>
>> Danny.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.