Menu

#2533 Source code should include instructions to remove PostBuildEvent in .csproj due to .pfx

KeePass_2.x
open
nobody
None
5
2020-02-21
2020-02-19
A Person
No

I've been trying to build the C# source code using JetBrains Rider and I've hit an obstacle caused by the .pfx file. There's a ReadMe_PFX.txt file that doesn't really explain the technical details, but even when the user disables signing the assembly, the build still doesn't work due to a Post-Build Event configured within .csproj, as it crashes with the following message:

Microsoft.Common.CurrentVersion.targets(5165, 5): [MSB3073] The command ""C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\sgen.exe" /assembly:"C:\your location of source\KeePass-2.43-Source\Build\KeePass\Debug\KeePass.exe" /force /nologo /compiler:/keycontainer:VS_KEY_27A70973F3FC3787 /compiler:/delaysign-" exited with code 9009.

This was mentioned in a thread from 2013:
https://sourceforge.net/p/keepass/discussion/329221/thread/e708cb94/
with the following message:

One more thing. In the 'KeePass' project, on the 'Build Events' tab, you also need to delete the 'Post-build event command line'.

Before realizing this fact, I've communicated with the JetBrains Rider support, and there are currently two issues on their side:

  1. there's no UI to disable Post-Build Events https://youtrack.jetbrains.com/issue/RIDER-4236
  2. double-clicking on the error doesn't bring the user to the .csproj configuration file https://youtrack.jetbrains.com/issue/RIDER-39696

The (manual) solution is to remove the following line within KeePass.csproj:
<PostBuildEvent>"$(FrameworkSDKDir)bin\sgen.exe" /assembly:"$(TargetPath)" /force /nologo /compiler:/keycontainer:VS_KEY_27A70973F3FC3787 /compiler:/delaysign-</PostBuildEvent>

I'm not saying you have to specifically mention this workaround, but you could at least mention the required step of "removing the Post-Build Event" in the provided ReadMe_PFX.txt file if the .csproj file doesn't follow a standard approach. (I'm not really expert on PFX, but I was told by support that "Rider does support pfx files, but in projects I've sent, there is an incorrect configuration.")


For a reference (if anyone's googling the same issue), this is the message if the user doesn't disable signing the assembly (and doesn't know the required steps omitted in the readme e.g. when using Visual Studio):

Microsoft.Common.CurrentVersion.targets(3214, 5): [MSB3325] Cannot import the following key file: KeePass.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_95C63959F53A1E3C

Microsoft.Common.CurrentVersion.targets(3214, 5): [MSB3321] Importing key file "KeePass.pfx" was canceled.

Discussion

  • Paul

    Paul - 2020-02-19

    You could have just asked for help here. Dominik is very helpful.

    cheers, Paul

     
  • Dominik Reichl

    Dominik Reichl - 2020-02-21

    Moving to open feature requests.

    Thanks and best regards,
    Dominik

     
  • Dominik Reichl

    Dominik Reichl - 2020-02-21

    Ticket moved from /p/keepass/bugs/1933/

     

Log in to post a comment.