安装项目有不同的调试和发布框架版本?

Setup project has different framework versions for debug and release?

将 VS2015 解决方案升级到 VS2019,其中包含 3 个项目:一个大型 vb.net 项目、一个非常小的 CSharp 项目和一个使用 Microsoft Visual Studio 安装程序从早期 VS2015 项目移植过来的安装项目项目延期。

解决方案编译和构建成功,但项目似乎被构建了两次,结果 setup1.msi 大约是迁移到 VS2019 之前构建的大小的两倍。

输出 window 显示行 -

构建文件'D:\Local Git\XXXX\XX\XXXX_GIT_Repository\XXXXX\Setup\Setup1\Release\Setup1.msi'...两次,似乎所有引用都被复制了两次。

的解决方案配置

调试(任何 CPU)vb app-x86,c# app-Any cpu,不包括 Setup1

发布(任何 CPU)vb app-x86,c# app-Any cpu,包括 Setup1

在 Setup1.vdproj 中,我看到 Debug 设置为 .NETFramework,Version=v4.0,而在 Release 模式下它是 .NETFramework,Version=v4.6.1

有谁知道为什么调试框架不同以及如何使用 VS2019 将其设置为发布框架IDE?

我怀疑这可能是导致重复消息和增加 msi 大小的原因。

"Debug"
    {
    "DisplayName" = "8:Debug"
    "IsDebugOnly" = "11:TRUE"
    "IsReleaseOnly" = "11:FALSE"
    "OutputFilename" = "8:Debug\Setup1.msi"
    "PackageFilesAs" = "3:2"
    "PackageFileSize" = "3:-2147483648"
    "CabType" = "3:1"
    "Compression" = "3:2"
    "SignOutput" = "11:FALSE"
    "CertificateFile" = "8:"
    "PrivateKeyFile" = "8:"
    "TimeStampServer" = "8:"
    "InstallerBootstrapper" = "3:2"
        "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
        {
        "Enabled" = "11:TRUE"
        "PromptEnabled" = "11:TRUE"
        "PrerequisitesLocation" = "2:1"
        "Url" = "8:"
        "ComponentsUrl" = "8:"
            "Items"
            {
                "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.0"
                {
                "Name" = "8:Microsoft .NET Framework 4 (x86 and x64)"
                "ProductCode" = "8:.NETFramework,Version=v4.0"
                }
            }
        }
    }
    "Release"
    {
    "DisplayName" = "8:Release"
    "IsDebugOnly" = "11:FALSE"
    "IsReleaseOnly" = "11:TRUE"
    "OutputFilename" = "8:Release\Setup1.msi"
    "PackageFilesAs" = "3:2"
    "PackageFileSize" = "3:-2147483648"
    "CabType" = "3:1"
    "Compression" = "3:2"
    "SignOutput" = "11:FALSE"
    "CertificateFile" = "8:"
    "PrivateKeyFile" = "8:"
    "TimeStampServer" = "8:"
    "InstallerBootstrapper" = "3:2"
        "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
        {
        "Enabled" = "11:TRUE"
        "PromptEnabled" = "11:TRUE"
        "PrerequisitesLocation" = "2:1"
        "Url" = "8:"
        "ComponentsUrl" = "8:"
            "Items"
            {
                "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.6.1"
                {
                "Name" = "8:Microsoft .NET Framework 4.6.1 (x86 and x64)"
                "ProductCode" = "8:.NETFramework,Version=v4.6.1"
                }

感谢阅读。

麦克

您确定双倍大小不是因为 .msi 中同时包含 x86 和 x64 代码,因为在构建配置中指定了 Any CPU 吗?

要对此进行测试,请转到 Project Properties->Compile,然后查看“目标 CPU”下列出的内容。 Selectx86 only,然后重建解决方案和安装包,安装MSI,看看C:\Program Files(x86)安装程序文件夹里的.exe有多大,或者直接看文件大小\obj\Release\bin\Release 文件夹中的 .exe,具体取决于您选择的目标。