Visual studio installer project code signing issue

jesdev7 6 Reputation points
2022-08-03T11:30:14.767+00:00

I've been trying to get my .NET core program signed (the executable and dlls) with Visual Studio.
In the build directory everything works fine: the properties of the files show my digital signature.

However when I use the Visual Studio Installer Projects extension to make a .msi installer it doesn't seem to sign anything.
The extracted files of my program after running the installer on a clean machine don't have a digital signature.
I've tried using the "Sign the assembly" option in the project settings as well as using signtool.exe in the post build event.
Both options seem to give the same end result.

I'm using Visual Studio 2019 Professional. Maybe there's an option I'm missing but I can't seem to figure it out.
This is the first time I'm using code signing in a project.

Developer technologies | .NET | Other

5 answers

Sort by: Newest
  1. Becker, W 66 Reputation points
    2026-09-04T12:02:00.7966667+00:00

    I managed to solve the problem by copying the signed output of my project inside the postbuild event to obj\release. This is leads to signed files inside the .msi file.

    post build event:

    if $(ConfigurationName) == Release (
       sign code artifact-signing "$(TargetPath)" -ase "%AZURE_SIGNING_ENDPOINT%" -asa "%AZURE_SIGNING_ACCOUNT%" -ascp "%AZURE_SIGNING_CERT_PROFILE%" -t http://timestamp.acs.microsoft.com/ -fd sha256
    
       copy /Y "$(TargetPath)" "$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)"
    )
    

    Was this answer helpful?

    0 comments No comments

  2. DANIEL GIBBS 0 Reputation points
    2025-08-08T00:50:47.4633333+00:00

    Had the same issue.

    Build your Code project (Release build) and sign the executables in \bin\release, bin\release\app.publish and \obj\release. Quicker than figuring out which one it uses.

    Before building the MSI (Release build) delete all files in the Installer project \bin\release folder (msi / exe)

    Now build the MSI - should be good

    Was this answer helpful?

    0 comments No comments

  3. Okundu Omeni 5 Reputation points
    2024-09-26T17:02:39.58+00:00

    I am having exactly the same issue with VS2022. I initially thought the issue was when I was doing the signing in the wrong folder as the binaries in the publish folder were not signed. So i added a pre-build event to the installer to sign the binaries in the published folder before generating the msi. When I checked the published folder the binaries are now signed but the generated msioutput binaries are still unsigned.

    It would appear the signing is being reversed by the packaging process.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  4. Michael Pasternak 0 Reputation points
    2024-03-28T22:15:08.08+00:00

    It does not work. Microsoft team, please fix this bug

    Was this answer helpful?

    0 comments No comments

  5. Tianyu Sun-MSFT 34,841 Reputation points Microsoft External Staff
    2022-08-18T09:37:45.3+00:00

    Hi @jesdev7 ,

    Welcome to Microsoft Q&A forum.

    Please try to select Release, and rebuild the Setup project under Release mode, then check if it works.

    232332-image.png

    Best Regards,
    Tianyu

    • If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.