I am trying to build .NET Framework assemblies using Rider, without having any version of Visual Studio installed. For the most part I am not having any problems.
However, I am having one build problem.
I want to have MSBuild sign my assembly DLL file ("TargetFileName"), with my certificate value, using the Windows SDK signtool.exe file. However, when I try to do this via a "SignFile" task in my .csproj file, I get a build error stating that the SignTool.exe file was not found at the path where the .csproj file resides. Here is a screen snippet.
**** More Details ****
Note that in my solution, I have selected the JetBrains amd64 version of MSBuild.exe.
Also note that I have also installed just the "Windows SDK Signing Tools for Desktop Apps" feature of the latest Windows SDK. (That is the only Windows SDK feature I currently have installed.) By installing that feature, versions of the Windows SDK signtool.exe file, as well as other files, can now be found installed at the following four locations:
C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\arm\signtool.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\arm64\signtool.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\signtool.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe
I have the following section of lines (where I have masked my thumbprint value) in my .csproj file that include a "SignFile" task.
<Target Name="Signing" AfterTargets="AfterBuild">
<Message Importance="High" Text="Signing $(TargetFileName) with our certificate..." />
<SignFile CertificateThumbprint="****************************************" SigningTarget="$(OutputPath)$(TargetFileName)" TargetFrameworkVersion="v4.7.2" />
Again, as noted earlier, when I build the project, I get the following error:
[project-file-name].csproj(90, 5): [MSB3482] An error occurred while signing: SignTool.exe was not found at path C:\****\[project-folder]\signtool.exe.
I am not sure why MSBuild does not find one of the installed versions of the signtool.exe file. From what I understand, MSBuild should be looking at some other path, or set of paths, before resorting to finally looking for the tool file in the project folder. As MSBuild code is open source, I have downloaded the code from GitHub and tried to follow its logic. It appears that the code is trying in some manner to find the signtool.exe file in "Windows SDK" related paths, but the code is hard to follow.
I can work around the problem with a "hack" where I copy a version of the signtool.exe into the project folder of every project that I want signed using the tool. But this is not an ideal long term solution.
So I am hoping that someone can shed some light on why MSBuild cannot find one of the versions of the signtool.exe tool file installed on my system as part of the Windows SDK. Or knows of additional steps or installations I need to do to get MSBuild to work for me for this build task in Rider.
Note: Last week I was trying to get this to work with Rider version 2022.3.2, and was having the same error. As of today I am using version 2023.1 EAP 4
Note: This works if I additionally install a version of Microsoft Visual Studio on the system. However, the current main point of my experimentation is to specifically get my projects building with Rider, without any version of Visual Studio installed/involved.