0

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

Community
  • 1
  • 1
Aman Thakur
  • 159
  • 4
  • 14
  • When are you signing the assemblies? Rebuilding a Setup and Deployment project causes a rebuild of all the referenced projects, i'd suggest setting up a Post-build event for every project (right-click project, Properties, Build Events) which signs the assemblies after building. – Fixation Sep 04 '14 at 12:10
  • I have added a code sign command already in the post build event and selected "On Successful build" in the "Run the Post Build:" combobox in the project properties. But still the assemblies are not signed in the Installer. :( – Aman Thakur Sep 04 '14 at 12:15
  • When I build the individual projects, their assemblies are successfully signed but when I build the setup project, then not. – Aman Thakur Sep 04 '14 at 12:23

1 Answers1

1

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

Fixation
  • 969
  • 6
  • 12
  • I was using Batch script in C# projects solution, So, i had to change the "cscript" with keyword "call" in your script and it worked for me. :) thanks a lot man.....i was very tired after searching for solution to the problem for long......you saved my day :) thanks a lot....! – Aman Thakur Sep 04 '14 at 14:31
  • 1
    I think you need to remove the "\" after `$(ProjectDir)` as it's inserted automatically. You might also need to include the build platform. Eg `cscript "C:\signmyfile.vbs" "$(ProjectDir)obj\$(Platform)\$(ConfigurationName)\$(TargetFileName)". – SteveCinq Dec 04 '19 at 04:05