diff --git a/packages/flutter_tools/templates/app/windows.tmpl/runner/Runner.rc b/packages/flutter_tools/templates/app/windows.tmpl/runner/Runner.rc.tmpl similarity index 55% rename from packages/flutter_tools/templates/app/windows.tmpl/runner/Runner.rc rename to packages/flutter_tools/templates/app/windows.tmpl/runner/Runner.rc.tmpl index 5b41a82a407..52b434289b1 100644 --- a/packages/flutter_tools/templates/app/windows.tmpl/runner/Runner.rc +++ b/packages/flutter_tools/templates/app/windows.tmpl/runner/Runner.rc.tmpl @@ -54,6 +54,57 @@ END // remains consistent on all systems. IDI_APP_ICON ICON "resources\\app_icon.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#ifdef FLUTTER_BUILD_NUMBER +#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER +#else +#define VERSION_AS_NUMBER 1,0,0 +#endif + +#ifdef FLUTTER_BUILD_NAME +#define VERSION_AS_STRING #FLUTTER_BUILD_NAME +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "{{organization}}" "\0" + VALUE "FileDescription", "{{description}}" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "{{projectName}}" "\0" + VALUE "LegalCopyright", "Copyright (C) {{year}} {{organization}}. All rights reserved." "\0" + VALUE "OriginalFilename", "{{projectName}}.exe" "\0" + VALUE "ProductName", "{{projectName}}" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + #endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/packages/flutter_tools/templates/template_manifest.json b/packages/flutter_tools/templates/template_manifest.json index 4e4fe4ce371..f3a1485754a 100644 --- a/packages/flutter_tools/templates/template_manifest.json +++ b/packages/flutter_tools/templates/template_manifest.json @@ -130,7 +130,7 @@ "templates/app/windows.tmpl/runner/resource.h", "templates/app/windows.tmpl/runner/resources/app_icon.ico.img.tmpl", "templates/app/windows.tmpl/runner/runner.exe.manifest", - "templates/app/windows.tmpl/runner/Runner.rc", + "templates/app/windows.tmpl/runner/Runner.rc.tmpl", "templates/app/windows.tmpl/runner/run_loop.cpp", "templates/app/windows.tmpl/runner/run_loop.h", "templates/app/windows.tmpl/runner/utils.cpp", diff --git a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart index 7df4f1ef927..a22a2a51551 100755 --- a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart @@ -811,6 +811,25 @@ void main() { FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true), }); + testUsingContext('Windows has correct VERSIONINFO', () async { + Cache.flutterRoot = '../..'; + when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision); + when(mockFlutterVersion.channel).thenReturn(frameworkChannel); + + final CreateCommand command = CreateCommand(); + final CommandRunner runner = createTestCommandRunner(command); + + await runner.run(['create', '--no-pub', '--org', 'com.foo.bar', projectDir.path]); + + final File resourceFile = projectDir.childDirectory('windows').childDirectory('runner').childFile('Runner.rc'); + expect(resourceFile.existsSync(), true); + final String contents = resourceFile.readAsStringSync(); + expect(contents, contains('"CompanyName", "com.foo.bar"')); + expect(contents, contains('"ProductName", "flutter_project"')); + }, overrides: { + FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true), + }); + testUsingContext('app does not include Windows by default', () async { Cache.flutterRoot = '../..'; when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);