[release/3.0] Fix version info missing from native binaries - #7867
Conversation
Allow the SDK to restore SourceLink and find its MSBuild props and targets files. These are used to fetch Git information. Use Arcade-generated '_version.c'. The new '_version.c' is identical to the old 'version.cpp'. The host build.sh generated an empty 'version.cpp' when it doesn't already exist at the specified path, which caused the "No version information" message to be included. (cherry picked from commit bac3b0d)
|
Does this add a full version resource to the binaries and effectively pass the test implied by this program? WPF had similar issues (missing version resources) and we realized that it was going to break bucketizing in Watson - so we also took a fix in 3.0 GA. // Add Microsoft.Diagnostics.Runtime NuGet package.
using Microsoft.Diagnostics.Runtime.Utilities;
using System;
using System.IO;
using System.Linq;
namespace ValidateVersion
{
class Program
{
static int Main(string[] args)
{
string tmpDirectory = Path.Combine(Path.GetTempPath(), "test_delete");
bool success = false;
if (args.Length > 0 && File.Exists(args[0]))
{
string localPath = args[0];
using (var file = File.OpenRead(localPath))
{
PEImage img = new PEImage(file);
bool hasVersion = img.Resources.Children.Where(c => c.Name == "Version").Count() > 0;
if (hasVersion)
{
//Console.WriteLine($"SUCCESS: {localPath}");
Console.Write(".");
success = true;
}
else
{
Console.WriteLine();
Console.WriteLine($"FAIL: {localPath}");
}
// Console.WriteLine("Resource nodes:");
// PrintResource(img.Resources, 1);
}
try
{
Directory.Delete(tmpDirectory, recursive: true);
}
catch
{
}
}
return success ? 1 : 0;
}
private static void PrintResource(ResourceEntry res, int index = 0)
{
Console.Write(new string(' ', index * 4));
Console.WriteLine(res.Name);
foreach (var item in res.Children)
PrintResource(item, index + 1);
}
}
} |
|
I'm not familiar with what the test implies, but it tells me this when I run it on some new Windows native outputs: |
|
If it succeeds, then your version resources are embedded and present - it's really just looking the version resource. You can also see it in file explorer properties dialog (details pane), or by opening the binary in Visual Studio and inspecting the resource directly. |
|
I see, yeah, I use |
* Update dependencies from https://github.com/dotnet/corefx build 20190820.10 (#7795) - System.Windows.Extensions - 4.6.0-rc1.19420.10 - System.CodeDom - 4.6.0-rc1.19420.10 - Microsoft.NETCore.Platforms - 3.0.0-rc1.19420.10 - Microsoft.NETCore.Targets - 3.0.0-rc1.19420.10 - Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-rc1.19420.10 - Microsoft.Win32.Registry - 4.6.0-rc1.19420.10 - Microsoft.Win32.Registry.AccessControl - 4.6.0-rc1.19420.10 - Microsoft.Win32.SystemEvents - 4.6.0-rc1.19420.10 - Microsoft.Windows.Compatibility - 3.0.0-rc1.19420.10 - System.Configuration.ConfigurationManager - 4.6.0-rc1.19420.10 - System.Resources.Extensions - 4.6.0-rc1.19420.10 - System.Security.AccessControl - 4.6.0-rc1.19420.10 - System.Security.Cryptography.Cng - 4.6.0-rc1.19420.10 - System.Security.Cryptography.Pkcs - 4.6.0-rc1.19420.10 - System.Security.Cryptography.ProtectedData - 4.6.0-rc1.19420.10 - System.Security.Cryptography.Xml - 4.6.0-rc1.19420.10 - System.Security.Permissions - 4.6.0-rc1.19420.10 - System.Security.Principal.Windows - 4.6.0-rc1.19420.10 - System.Text.Encodings.Web - 4.6.0-rc1.19420.10 - System.Text.Json - 4.6.0-rc1.19420.10 - System.Threading.AccessControl - 4.6.0-rc1.19420.10 - System.Diagnostics.EventLog - 4.6.0-rc1.19420.10 - System.Diagnostics.PerformanceCounter - 4.6.0-rc1.19420.10 - System.DirectoryServices - 4.6.0-rc1.19420.10 - System.Drawing.Common - 4.6.0-rc1.19420.10 - System.IO.FileSystem.AccessControl - 4.6.0-rc1.19420.10 - System.IO.Packaging - 4.6.0-rc1.19420.10 * Categorize shipping/nonshipping NuGet packages (#7792) (cherry picked from commit 645aa3a) * Split blob publish into stages run before Arcade (#7796) * Split blob publish into stages run before Arcade The Arcade publish stages contain the job that promotes the build, causing auto-update PRs to be generated. This means that running installer publish after Arcade can cause a temporarily broken update PR. To fix this, publish blobs before the Arcade stages. Leave dotnet/versions publish and build finalization until after the Arcade stages, so that they still only happen after the nupkgs are published. * Changes per feedback Remove "Custom" verbiage, not useful and in some cases now incorrect. Order publish.yml stages by dependency to help readability. (cherry picked from commit 54ae67a) * Update dependencies from https://github.com/dotnet/standard build 20190821.7 (#7798) - NETStandard.Library - 2.1.0-prerelease.19421.7 * Update dependencies from https://github.com/dotnet/coreclr build 20190821.8 (#7799) - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19421.8 * Update dependencies from https://github.com/dotnet/standard build 20190822.3 (#7805) - NETStandard.Library - 2.1.0-prerelease.19422.3 * Stop the BAR publish job assigning channel early (#7808) * Update dependencies from https://github.com/dotnet/arcade build 20190821.4 (#7802) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19421.4 * Update dependencies from https://github.com/dotnet/coreclr build 20190822.4 (#7812) - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19422.4 * [release/3.0] Fix bundle installer signing (#7821) * Fix bundle installer signing * Remove SignMsiFiles.proj MSBuild cycle This OrderProjectReference is unnecessary: ensuring the MSI files are signed before bundling them is already handled by the infrastructure in the GetBundledMsiFiles target. * Update dependencies from https://github.com/dotnet/arcade build 20190822.24 (#7814) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19422.24 * Update dependencies from https://github.com/dotnet/standard build 20190823.3 (#7826) - NETStandard.Library - 2.1.0-prerelease.19423.3 * Update dependencies from https://github.com/dotnet/arcade build 20190823.6 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19423.6 * Update dependencies from https://github.com/dotnet/arcade build 20190824.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19424.1 * Update dependencies from https://github.com/dotnet/standard build 20190825.3 (#7837) - NETStandard.Library - 2.1.0-prerelease.19425.3 * Update dependencies from https://github.com/dotnet/coreclr build 20190826.2 (#7845) - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19426.2 * Update dependencies from https://github.com/dotnet/coreclr build 20190826.4 (#7856) - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19426.4 * Set up auto-update for infrastructure packages (#7853) * Set up auto-update for infra packages * React to packaging tools centralizing specs (cherry picked from commit ec56798) * Enable signing validation with exclusions (#7854) (cherry picked from commit e37b0cf) * [release/3.0] Update dependencies from dotnet/arcade (#7841) * Update dependencies from https://github.com/dotnet/arcade build 20190825.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19425.1 * Update dependencies from https://github.com/dotnet/arcade build 20190826.12 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19426.12 * Update dependencies from https://github.com/dotnet/standard build 20190827.3 (#7866) - NETStandard.Library - 2.1.0-prerelease.19427.3 * Fix version info missing from native binaries (#7867) Allow the SDK to restore SourceLink and find its MSBuild props and targets files. These are used to fetch Git information. Use Arcade-generated '_version.c'. The new '_version.c' is identical to the old 'version.cpp'. The host build.sh generated an empty 'version.cpp' when it doesn't already exist at the specified path, which caused the "No version information" message to be included. (cherry picked from commit bac3b0d) * [release/3.0] Update dependencies from dotnet/coreclr (#7865) * Update dependencies from https://github.com/dotnet/coreclr build 20190827.2 - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19427.2 * Update dependencies from https://github.com/dotnet/coreclr build 20190827.5 - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19427.5 * Update dependencies from https://github.com/dotnet/coreclr build 20190827.10 (#7874) - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19427.10 * Update dependencies from https://github.com/dotnet/arcade build 20190827.8 (#7876) - Microsoft.DotNet.VersionTools.Tasks - 1.0.0-beta.19427.8 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19427.8 - Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19427.8 - Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19427.8 * Update dependencies from https://github.com/dotnet/standard build 20190828.3 (#7878) - NETStandard.Library - 2.1.0-prerelease.19428.3 * Update dependencies from https://github.com/dotnet/coreclr build 20190828.2 (#7880) - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19428.2 * Update dependencies from https://github.com/dotnet/coreclr build 20190828.6 (#7884) - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19428.6 * Update dependencies from https://github.com/dotnet/arcade build 20190828.9 (#7886) - Microsoft.DotNet.VersionTools.Tasks - 1.0.0-beta.19428.9 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19428.9 - Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19428.9 - Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19428.9 * Update dependencies from https://github.com/dotnet/coreclr build 20190829.2 (#7891) - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19429.2 * Update dependencies from https://github.com/dotnet/standard build 20190829.3 (#7894) - NETStandard.Library - 2.1.0-prerelease.19429.3 * Update dependencies from https://github.com/dotnet/coreclr build 20190829.4 (#7896) - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19429.4 * Update dependencies from https://github.com/dotnet/coreclr build 20190830.2 (#7907) - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19430.2 * Update dependencies from https://github.com/dotnet/coreclr build 20190830.3 (#7909) - Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-rc1.19430.3 * Update dependencies from https://github.com/dotnet/corefx build 20190903.4 (#7943) - System.Windows.Extensions - 4.6.0-rc1.19453.4 - System.CodeDom - 4.6.0-rc1.19453.4 - Microsoft.NETCore.Platforms - 3.0.0-rc1.19453.4 - Microsoft.NETCore.Targets - 3.0.0-rc1.19453.4 - Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-rc1.19453.4 - Microsoft.Win32.Registry - 4.6.0-rc1.19453.4 - Microsoft.Win32.Registry.AccessControl - 4.6.0-rc1.19453.4 - Microsoft.Win32.SystemEvents - 4.6.0-rc1.19453.4 - Microsoft.Windows.Compatibility - 3.0.0-rc1.19453.4 - System.Configuration.ConfigurationManager - 4.6.0-rc1.19453.4 - System.Resources.Extensions - 4.6.0-rc1.19453.4 - System.Security.AccessControl - 4.6.0-rc1.19453.4 - System.Security.Cryptography.Cng - 4.6.0-rc1.19453.4 - System.Security.Cryptography.Pkcs - 4.6.0-rc1.19453.4 - System.Security.Cryptography.ProtectedData - 4.6.0-rc1.19453.4 - System.Security.Cryptography.Xml - 4.6.0-rc1.19453.4 - System.Security.Permissions - 4.6.0-rc1.19453.4 - System.Security.Principal.Windows - 4.6.0-rc1.19453.4 - System.Text.Encodings.Web - 4.6.0-rc1.19453.4 - System.Text.Json - 4.6.0-rc1.19453.4 - System.Threading.AccessControl - 4.6.0-rc1.19453.4 - System.Diagnostics.EventLog - 4.6.0-rc1.19453.4 - System.Diagnostics.PerformanceCounter - 4.6.0-rc1.19453.4 - System.DirectoryServices - 4.6.0-rc1.19453.4 - System.Drawing.Common - 4.6.0-rc1.19453.4 - System.IO.FileSystem.AccessControl - 4.6.0-rc1.19453.4 - System.IO.Packaging - 4.6.0-rc1.19453.4 * Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-wpf-int build 20190820.2 (#7956) - Microsoft.DotNet.Wpf.DncEng - 5.0.0-alpha1.19420.2 Dependency coherency updates - Microsoft.Private.Winforms - 4.8.0-preview9.19417.1 (parent: Microsoft.DotNet.Wpf.DncEng) - Microsoft.DotNet.Wpf.GitHub - 4.8.0-preview9.19417.4 (parent: Microsoft.DotNet.Wpf.DncEng) * Update dependencies from https://github.com/dotnet/corefx build 20190904.1 (#7957) - System.Windows.Extensions - 4.6.0-rc1.19454.1 - System.CodeDom - 4.6.0-rc1.19454.1 - Microsoft.NETCore.Platforms - 3.0.0-rc1.19454.1 - Microsoft.NETCore.Targets - 3.0.0-rc1.19454.1 - Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-rc1.19454.1 - Microsoft.Win32.Registry - 4.6.0-rc1.19454.1 - Microsoft.Win32.Registry.AccessControl - 4.6.0-rc1.19454.1 - Microsoft.Win32.SystemEvents - 4.6.0-rc1.19454.1 - Microsoft.Windows.Compatibility - 3.0.0-rc1.19454.1 - System.Configuration.ConfigurationManager - 4.6.0-rc1.19454.1 - System.Resources.Extensions - 4.6.0-rc1.19454.1 - System.Security.AccessControl - 4.6.0-rc1.19454.1 - System.Security.Cryptography.Cng - 4.6.0-rc1.19454.1 - System.Security.Cryptography.Pkcs - 4.6.0-rc1.19454.1 - System.Security.Cryptography.ProtectedData - 4.6.0-rc1.19454.1 - System.Security.Cryptography.Xml - 4.6.0-rc1.19454.1 - System.Security.Permissions - 4.6.0-rc1.19454.1 - System.Security.Principal.Windows - 4.6.0-rc1.19454.1 - System.Text.Encodings.Web - 4.6.0-rc1.19454.1 - System.Text.Json - 4.6.0-rc1.19454.1 - System.Threading.AccessControl - 4.6.0-rc1.19454.1 - System.Diagnostics.EventLog - 4.6.0-rc1.19454.1 - System.Diagnostics.PerformanceCounter - 4.6.0-rc1.19454.1 - System.DirectoryServices - 4.6.0-rc1.19454.1 - System.Drawing.Common - 4.6.0-rc1.19454.1 - System.IO.FileSystem.AccessControl - 4.6.0-rc1.19454.1 - System.IO.Packaging - 4.6.0-rc1.19454.1 * Update dependencies from https://github.com/dotnet/standard build 20190904.3 (#7961) - NETStandard.Library - 2.1.0-prerelease.19454.3 * Update dependencies from https://github.com/dotnet/standard build 20190904.4 (#7962) - NETStandard.Library - 2.1.0-prerelease.19454.4 * [release/3.0] Update dependencies from dotnet/arcade (#7902) * Update dependencies from https://github.com/dotnet/arcade build 20190829.16 - Microsoft.DotNet.VersionTools.Tasks - 1.0.0-beta.19429.16 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19429.16 - Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19429.16 - Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19429.16 * Update dependencies from https://github.com/dotnet/arcade build 20190830.3 - Microsoft.DotNet.VersionTools.Tasks - 1.0.0-beta.19430.3 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19430.3 - Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19430.3 - Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19430.3 * Update dependencies from https://github.com/dotnet/arcade build 20190903.5 - Microsoft.DotNet.VersionTools.Tasks - 1.0.0-beta.19453.5 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19453.5 - Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19453.5 - Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19453.5 * Remove WPF ignored duplicates: improve validation (#7970) (cherry picked from commit f14056f) * Update dependencies from https://github.com/dotnet/corefx build 20190904.7 (#7973) - System.Windows.Extensions - 4.6.0-rc1.19454.7 - System.CodeDom - 4.6.0-rc1.19454.7 - Microsoft.NETCore.Platforms - 3.0.0-rc1.19454.7 - Microsoft.NETCore.Targets - 3.0.0-rc1.19454.7 - Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-rc1.19454.7 - Microsoft.Win32.Registry - 4.6.0-rc1.19454.7 - Microsoft.Win32.Registry.AccessControl - 4.6.0-rc1.19454.7 - Microsoft.Win32.SystemEvents - 4.6.0-rc1.19454.7 - Microsoft.Windows.Compatibility - 3.0.0-rc1.19454.7 - System.Configuration.ConfigurationManager - 4.6.0-rc1.19454.7 - System.Resources.Extensions - 4.6.0-rc1.19454.7 - System.Security.AccessControl - 4.6.0-rc1.19454.7 - System.Security.Cryptography.Cng - 4.6.0-rc1.19454.7 - System.Security.Cryptography.Pkcs - 4.6.0-rc1.19454.7 - System.Security.Cryptography.ProtectedData - 4.6.0-rc1.19454.7 - System.Security.Cryptography.Xml - 4.6.0-rc1.19454.7 - System.Security.Permissions - 4.6.0-rc1.19454.7 - System.Security.Principal.Windows - 4.6.0-rc1.19454.7 - System.Text.Encodings.Web - 4.6.0-rc1.19454.7 - System.Text.Json - 4.6.0-rc1.19454.7 - System.Threading.AccessControl - 4.6.0-rc1.19454.7 - System.Diagnostics.EventLog - 4.6.0-rc1.19454.7 - System.Diagnostics.PerformanceCounter - 4.6.0-rc1.19454.7 - System.DirectoryServices - 4.6.0-rc1.19454.7 - System.Drawing.Common - 4.6.0-rc1.19454.7 - System.IO.FileSystem.AccessControl - 4.6.0-rc1.19454.7 - System.IO.Packaging - 4.6.0-rc1.19454.7 * Update dependencies from https://github.com/dotnet/corefx build 20190904.13 (#7979) - System.Windows.Extensions - 4.6.0-rc1.19454.13 - System.CodeDom - 4.6.0-rc1.19454.13 - Microsoft.NETCore.Platforms - 3.0.0-rc1.19454.13 - Microsoft.NETCore.Targets - 3.0.0-rc1.19454.13 - Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-rc1.19454.13 - Microsoft.Win32.Registry - 4.6.0-rc1.19454.13 - Microsoft.Win32.Registry.AccessControl - 4.6.0-rc1.19454.13 - Microsoft.Win32.SystemEvents - 4.6.0-rc1.19454.13 - Microsoft.Windows.Compatibility - 3.0.0-rc1.19454.13 - System.Configuration.ConfigurationManager - 4.6.0-rc1.19454.13 - System.Resources.Extensions - 4.6.0-rc1.19454.13 - System.Security.AccessControl - 4.6.0-rc1.19454.13 - System.Security.Cryptography.Cng - 4.6.0-rc1.19454.13 - System.Security.Cryptography.Pkcs - 4.6.0-rc1.19454.13 - System.Security.Cryptography.ProtectedData - 4.6.0-rc1.19454.13 - System.Security.Cryptography.Xml - 4.6.0-rc1.19454.13 - System.Security.Permissions - 4.6.0-rc1.19454.13 - System.Security.Principal.Windows - 4.6.0-rc1.19454.13 - System.Text.Encodings.Web - 4.6.0-rc1.19454.13 - System.Text.Json - 4.6.0-rc1.19454.13 - System.Threading.AccessControl - 4.6.0-rc1.19454.13 - System.Diagnostics.EventLog - 4.6.0-rc1.19454.13 - System.Diagnostics.PerformanceCounter - 4.6.0-rc1.19454.13 - System.DirectoryServices - 4.6.0-rc1.19454.13 - System.Drawing.Common - 4.6.0-rc1.19454.13 - System.IO.FileSystem.AccessControl - 4.6.0-rc1.19454.13 - System.IO.Packaging - 4.6.0-rc1.19454.13 * Update dependencies from https://github.com/dotnet/arcade build 20190904.31 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19454.31 * Enable post-build publishing for 3.1 channels and fixup legacy channle names
Description
For https://github.com/dotnet/core-setup/issues/7635. Ports #7864 to
release/3.0.Adds the expected product version and Git info to native binaries.
Customer Impact
Without this, devs who inspect the native host binaries to figure out where they came from will instead see a message like
3,0,19,40809 @Commit: unknownor@(#)No version information produced.With this, the message contains the version and commit hash.
Regression?
Yes, this worked before the migration to the Arcade SDK.
Risk
Low. With
src/corehost/build.projnow depending a little more on the Arcade SDK, there may be undetected changes, however the project is a thin wrapper around a shell script, so this seems unlikely.@vitek-karas @elinor-fung