First I would create a non expiring certificate.
Start | All Programs | Microsoft Visual Studio | Visual Studio Tools | Developer Command Prompt for VS201X | Right click and "Run as administrator"
Then paste the following commands. You can update the certificate name to what you want.
Exclude the "-f" parameter on the first run or the .pfx file won't get created.
MakeCert /n "CN=Anthony" /r /h 0 /eku "1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.13" /e "01/16/2174" /sv Anthony.pvk Anthony.cer
pvk2pfx -pvk Anthony.pvk -spc Anthony.cer -pfx Anthony.pfx –f
- the date format is the US standard MM/DD/YYYY
- the "-f" parameter is used for overwriting an existing file.
In the Visual Studio project properties, select "Signing" click on "Select from File…"
Navigate to C:\Windows\System32 and select the certificate file (*.pfx)
To learn more about the used tools
Makecert
http://msdn.microsoft.com/en-us/library/bfsktky3%28v=vs.80%29.aspx
Pvk2Pfx
http://msdn.microsoft.com/en-us/library/windows/hardware/ff550672%28v=vs.85%29.aspx
References:
https://bernhardelbl.wordpress.com/2012/03/20/create-a-non-expiring-test-certificate-pfx-for-clickonce-applications/