Search code examples
c#.netvisual-studio-2010code-signingsetup-project

Problems in Code Sign


I am having hard time while code signing my Visual Studio Project. I have multiple projects in my Visual Studio Solution. Each project is generating different assemblies. And I am trying to make a Setup Installer for all those project's output.

I have created a BATCH script for signing the assemblies. And I am able to successfully sign the assemblies of my project.

I have even signed the MSI installer successfully.

So, what's the problem I am getting?

The problem that I am facing is, when I build the setup and deployment project in Visual Studio, the Assemblies which are added in the setup are not signed. Although, I signed them Successfully before building the setup project.

I found 2 articles on stackoverflow here having a similar issue: How to sign installation files of a Visual Studio .msi Signed exe becomes unsigned after adding project output in setup package using visual studio 2008

But this is also not working for me. I have tried signing the OBJ files of the projects before Building the Setup project. But still, the assemblies which are added to the project are not signed.

So, I surrendered and thought to put a query here. Any help would be really appreciated.

Thanks

With Regards Aman


Solution

  • In the File System page of the Setup and Deployment project i found that right clicking the "Primary Output from..." selecting the "Outputs" shows that it uses the .dll build in \obj\Debug\myfile.dll

    After changing the Post-build command line it worked for me. Change it to something like this:

     cscript "C:\signmyfile.vbs" "$(ProjectDir)\obj\$(ConfigurationName)\$(TargetFileName)"
    

    where "C:\signmyfile.vbs" is your method of signing ofcourse

    edit: changed .bat to .vbs as i'm using cscript