question

RichardArnold-1221 avatar image
0 Votes"
RichardArnold-1221 asked TimonYang-MSFT commented

ClickOnce Publish Fails on Visual Studio 2010 Premium

I have a C# 4.0 WinForms application that I created using Visual Studio 2010 Premium SP1 on Windows 10.

Over a period of a year or more, I have modified and deployed this same App many times, using ClickOnce.
Visual Studio has always allowed me to successfully publish this app for deployment, until now.

The app contains one other project, a simple “SplashScreen” project, which I also have in references.
I recently made one small modification to the main code, which works successfully.

Please note, the application successfully builds and runs without any errors.
However, now, after attempting to publish, 2-separate errors are thrown, as listed below.

1) Cannot publish because a project failed to build.

2) An error occurred while signing: The parameter is incorrect.

My certificate has not expired, and both projects build.
The Output window reads as follows.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(4539, 5): error MSB3482: An error occurred while signing: The parameter is incorrect.
Error: Cannot publish because a project failed to build.
=========Build: 2 succeeded or up-to-date, 0 failed, 0 skipped=========
=========Publish: 0 succeeded, 1 failed, 0 skipped=========
I have also tried to Build > Publish by using the menu in Solution Explorer, rather than from the Publish pane of VS.
Can anyone suggest how to correct this situation, as I am unable to publish my app any longer.

dotnet-csharp
· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@RichardArnold-1221
Please check the following links:
MSBuild Error MSB3482
An error occurred while signing: The parameter is incorrect in Visual Studio 2015

Is your build is running in a service or in a user account other than the one that imported the certificate? Try turning off any Local Security Policy settings that require private key protection. Next, delete and re-import the certificate for the build's user account.

0 Votes 0 ·

@TimonYang-MSFT I tried turning off the Local Security Policy setting that I think requires private key protection. (See image below)
77880-system-cryptography-force-strong-key-protection-no.png


77941-system-cryptography-force-strong-key-protection-us.png


I'm not sure whether this is the correct Local Security Policy to effect, but in any case, after deleting and re-adding my certificate, the Publish still failed with the same 2-errors. If the above security setting is not the correct on to modify, please indicate which one I should modify.

0 Votes 0 ·

@TimonYang-MSFT Since this is Visual Studio 2010, could the issue be related to VS2010's Test Certificate using SHA1 instead of SHA2? I found an article on line that stated that "After January 1, 2017, Windows will treat any SHA-1 timestamp or signature hash as if the code did not have a timestamp signature." I have to wonder if my test certificate, which VS2010 creates, is SHA1 and this might be why the above 2-errors regarding an error while signing are occurring. I also installed .Net Framework 4.5.2, but even after installing, VS does not appear to reference 4.5.2 anywhere.
Please let me know if Microsoft's deprecation of SHA1 is the problem here, or please suggest what more I might do in order to successfully have ClickOnce create my deployment package.
[1]: https://social.msdn.microsoft.com/Forums/vstudio/en-US/ae7ab48c-ae1d-44a9-b96e-f2ba8e8fced1/signing-a-vsto-2010-excel-addin-targeting-net-framework-40-using-a-sha2-certificate?forum=vsto


0 Votes 0 ·
TimonYang-MSFT avatar image TimonYang-MSFT RichardArnold-1221 ·

I'm not sure if the certificate uses SHA1, I don't have Visual Studio 2010.
But even if it uses SHA1, I think it may not be the cause of the current problem. After all, you have been using VS2010, so this should not have changed.
If you want to use .Net 4.5, maybe you can refer to the solution in this link, but a better way is to use the latest Visual Studio 2019, which is easier to use and compatible with earlier versions, and adds a lot of interesting new features .

1 Vote 1 ·
Show more comments

1 Answer

RichardArnold-1221 avatar image
1 Vote"
RichardArnold-1221 answered TimonYang-MSFT commented

@TimonYang-MSFT This is a follow up on the problem I experienced. Although I will continue to use Visual Studio 2019 Community, the issue did prove to be related to VS2010's Test Certificate using SHA1 instead of SHA2, and Microsoft no longer supporting SHA1. On a hunch, I changed the TimeStamp server from the following: http://timestamp.globalsign.com/scripts/timstamp.dll to this: http://timestamp.globalsign.com/?signature=sha2. After compiling my application, VS did a successful Publish of this ClickOnce deployed app. For the audience still using Visual Studio 2010, this may help solve this same issue, if they experience it.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I'm glad to hear that your problem has been solved, and I have converted your comment into an answer.
You can accept it so that members who have similar problems in the future can quickly find a solution.
Thank you for sharing.

0 Votes 0 ·