问题描述
我有一个clickonce解决方案,该解决方案可在安装了VS 2015的多台开发人员计算机上使用。但是,它在我们的buildserver上不起作用,它带有此signFile错误。我已经安装
I have a clickonce solution that works on several developer machines with VS 2015 installed. However, it doesn't work on our buildserver it comes with this signFile error. I have installed
- 构建工具2015更新3
- .Net 4.6.2 SDK
- Windows软件开发工具包
但是,显然没有正确设置signtool.exe的路径。如果我禁用清单签名,它将继续进行,但是会出现setup.bin丢失错误。
But apparantly the path to the signtool.exe isn't correctly setup. If I disable signing of manifest it will continue on, but come up with a setup.bin missing error.
有人知道如何解决SignFile问题吗?
Do anyone have a good clue how to solve the SignFile problem ?
[_DeploymentComputeClickOnceManifestInfo] Using "SignFile" task from assembly "Microsoft.Build.Tasks.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
[_DeploymentComputeClickOnceManifestInfo] SignFile
[SignFile] C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(3616, 5): error MSB4018: The "SignFile" task failed unexpectedly.
System.ArgumentNullException: Value cannot be null.
Parameter name: path1
at System.IO.Path.Combine(String path1, String path2, String path3)
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.SecurityUtilities.GetPathToTool(ResourceManager resources)
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.SecurityUtilities.SignPEFile(X509Certificate2 cert, Uri timestampUrl, String path, ResourceManager resources, Boolean useSha256)
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.SecurityUtilities.SignFileInternal(X509Certificate2 cert, Uri timestampUrl, String path, Boolean targetFrameworkSupportsSha256, ResourceManager resources)
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.SecurityUtilities.SignFile(X509Certificate2 cert, Uri timestampUrl, String path)
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.SecurityUtilities.SignFile(String certThumbprint, Uri timestampUrl, String path, String targetFrameworkVersion)
at Microsoft.Build.Tasks.SignFile.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
推荐答案
错误正在。
To help identify the specific SDK version, I pulled down the source code from the Update 3 release at https://github.com/Microsoft/msbuild/releases.
internal static string GetPathToTool(System.Resources.ResourceManager resources)
{
#pragma warning disable 618 // Disabling warning on using internal ToolLocationHelper API. At some point we should migrate this.
string toolPath = ToolLocationHelper.GetPathToWindowsSdkFile(ToolName, TargetDotNetFrameworkVersion.VersionLatest, VisualStudioVersion.VersionLatest);
if (toolPath == null)
toolPath = ToolLocationHelper.GetPathToWindowsSdkFile(ToolName, TargetDotNetFrameworkVersion.Version45, VisualStudioVersion.Version110);
if (toolPath == null)
toolPath = Path.Combine(ToolLocationHelper.GetPathToDotNetFrameworkSdk(TargetDotNetFrameworkVersion.Version40, VisualStudioVersion.Version100), "bin", ToolName);
if (toolPath == null)
toolPath = Path.Combine(Directory.GetCurrentDirectory(), ToolName);
if (!File.Exists(toolPath))
throw new ApplicationException(String.Format(CultureInfo.CurrentCulture, resources.GetString("SecurityUtil.SigntoolNotFound"), toolPath));
return toolPath;
#pragma warning restore 618
}
进一步研究解决方案,我确定最新版本的Build Tools(您安装的版本)不包含更改到 Shared\FrameworkLocationHelper.cs
,它增加了对Framework 4.6.2的支持。因此,为回答您的后续问题,安装4.6.1 SDK应该可以解决问题。
Digging further into the solution, I determined that the latest release of Build Tools (the one you installed) does not include the change to Shared\FrameworkLocationHelper.cs
that added support for Framework 4.6.2. So to answer your follow-up question, installing the 4.6.1 SDK should do the trick.
更新2:
OP确定了另一种解决方案:明确设置 TargetFrameworkSDKToolsDirectory
属性的值,例如通过在调用 msbuild.exe
时添加 / p:TargetFrameworkSDKToolsDirectory = PATH SIGNTOOL.EXE(?)
作为参数命令行。
The OP identified an alternative solution: explicitly setting the value of the TargetFrameworkSDKToolsDirectory
property, e.g. by adding /p:TargetFrameworkSDKToolsDirectory=PATH TO SIGNTOOL.EXE(?)
as an argument when invoking msbuild.exe
from the command line.
这篇关于错误MSB4018:“ SignFile”生成服务器上的任务意外失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!