Hi,
I've got a solution file with the following projects:
- MyAssembly.prj
- MyWebSite.prj
- MyWebSiteSetUp.prj
Is there a way I can sign the output assembly MyAssembly during a release
build configuration?
Currently, I have a post build event in MyAssembly.prj (see below) which
signs the assembly based upon the configuration. If a release build, it
uses sn -R with the private key to rewrite the delay signed assembly used
during the debug builds
The problem is, when I deploy to the destination web server, I'm getting:
check of the signature failed for assembly 'MyAssembly'.
My goal is to have the signing process be part of the Solution, but I have
yet to find a way to pull that off.
Here is what my postbuild script looks like for MyAssembly:
-----------------------------------------------------------------
@echo off
if "$(ConfigurationName)"=="Debug" goto DebugBuildCommands
if "$(ConfigurationName)"=="Release" goto ReleaseBuildCommands
echo Error build must be either build or release
goto DoneExit
:DebugBuildCommands
echo signing debug
sn -Vr "$(TargetPath)"
echo copying $(TargetFileName) to GAC
gacutil /if "$(TargetPath)"
goto DoneExit
:ReleaseBuildCommands
echo signing release
sn -R "$(TargetPath)" c:\MorpheusCommon\BCGICore.snk
echo copying $(TargetFileName) to GAC
gacutil /if "$(TargetPath)"
echo copy "$(TargetFileName)" to
D:\Projects\Morpheus\Web\MGComponentsServer\bin
copy "$(TargetPath)" "D:\Projects\Morpheus\Web\MGComponentsServer\bin"
:DoneExit
exit
==============================================
TIA
geo
Gary Chang[MSFT] - 18 Jan 2005 10:02 GMT
Hi geo,
>If a release build, it uses sn -R with the private key to rewrite the
delay
>signed assembly used during the debug builds
>
>The problem is, when I deploy to the destination web server, I'm getting:
>
> check of the signature failed for assembly 'MyAssembly'.
At first, I want to make clear If you signed the Release assembly outside
the VS.NET, is it alright?
Thanks!
Best regards,
Gary Chang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
DotNetGruven - 18 Jan 2005 15:58 GMT
Hy Gary,
No, I'm trying to automate the process.
So, signing is taking place as part of the post build events. WHen the
configuration is Debug, I delay sign. When release mode, the assemblies are
resigned with sn -R
Thanks
geo
> Hi geo,
>
[quoted text clipped - 20 lines]
> rights.
> --------------------
Gary Chang[MSFT] - 19 Jan 2005 02:36 GMT
Hi geo,
I think the problem is when you use the sn -R to sign an assembly, it needs
that assembly should be signed or delay signed. However in your post build
event's script, the release version's assembly hasn't been signed or delay
signed(since the debug version's assembly has been delay signed, but the
release ver assembly is a differently package from the debug ver one).
So I suggest you can try to modify your script as the following:
..
:ReleaseBuildCommands
echo signing release
sn -Vr "$(TargetPath)"
sn -R "$(TargetPath)" c:\MorpheusCommon\BCGICore.snk
..
Thanks for your understanding!
Best regards,
Gary Chang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------