Reputation: 1174
I need to sign a LOB/enterprise app (built as APPX) for Windows Phone 8.1 for internal distribution. I tried to use MSBuild SignFile task:
<Target Name="SignAppxPhone" AfterTargets="_CreateAppxPackage">
<SignFile
CertificateThumbprint="$(CertificateThumbprint)"
SigningTarget="$(AppxPackageOutput)"
TargetFrameworkVersion="v4.5" />
</Target>
I am getting the following error:
error MSB3482: An error occurred while signing: Data at the root level is invalid. Line 1, position 1.
What's wrong?
Upvotes: 2
Views: 765
Reputation: 1174
MSBuild SignFile task only supports PE files (*.exe, *.dll) and XML, unfortunately. APPX files or CAB files are not supported. I looked in Reflector at the latest version of Microsoft.Build.Tasks.v12.0.dll -- shipped with Visual Studio 2013 Update 3 RC, built on 6/25/2014. It's been reported to Microsoft 6 years ago.
A reasonable workaround is to <Exec>
signtool.exe directly:
<Target Name="SignAppxPhone" AfterTargets="_CreateAppxPackage">
<Exec Command=""$(SignAppxPackageExeFullPath)" sign /fd SHA256 /sha1 $(CertificateThumbprint) /t http://timestamp.verisign.com/scripts/timstamp.dll "$(AppxPackageOutput)"" />
</Target>
Upvotes: 1