AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / coding / 问题

问题[wix](coding)

Martin Hope
Dmitry Kosovets
Asked: 2025-02-11 23:33:48 +0800 CST

当提供属性值时,WiX 安装程序 ScrollableText 为空

  • 5

我正在尝试创建一个 WiX v4 安装程序,它将根据区域显示不同的 EULA。当我使用以下命令提供静态文本时:

<Control Id="LicenseText" Type="ScrollableText" X="18" Y="105" Width="348" Height="120" TabSkip="no" Sunken="yes">
  <Text Value="!(loc.EulaInt)" />
</Control>

其中 EulaInt 包含 RTF 内容,它显示正确。但是当我尝试使用以下代码提供属性值时

<Property Id="EULATEXT" Value="!(loc.EulaInt)" />
...
<Control Id="LicenseText" Type="ScrollableText" X="18" Y="105" Width="348" Height="120" TabSkip="no" Sunken="yes">
  <Text Value="[EULATEXT]" />
</Control>

它显示一个空白字段。如能提供任何帮助,我们将不胜感激

wix
  • 1 个回答
  • 20 Views
Martin Hope
Yola
Asked: 2025-02-04 04:22:32 +0800 CST

Wix 未收集 .runtimeconfig.json

  • 5

Wix 收集不会将 .runtimeconfig.json 文件包含到 .wxs 文件中。如果没有此文件,我的应用程序就无法运行。我该如何包含它?如果 Wix 不收集我想要包含的某些文件,我该怎么办?

wix
  • 1 个回答
  • 17 Views
Martin Hope
nikhil
Asked: 2024-11-08 17:29:33 +0800 CST

删除旧包后,Wix 不会安装新的 exe 包

  • 5

我正在尝试卸载 SqlServer 2017 并安装 SqlServer 2022。它正在卸载 SqlServer 2017,但从不安装 2022。请帮忙。

我有一个名为 RemoveSql2017.cs 的类,如下所示:

 public class RemoveSQL2017
    {
        const string UNINSTALL_SQL_2017 = "/Action=Uninstall /INSTANCENAME=PHARMSPEC /FEATURES=SQL /QS /HIDECONSOLE";
        const string sqlFile = "DetachPharmSpecDB.sql";
        const string DB_INSTANCE = "PHARMSPEC";
        const int COMMAND_LINE_WAIT = 10000;
        private static WixBootstrapper _bootstrapper;
        const string registryKey = @"SOFTWARE\HIAC\PharmSpec\Database";
        const string subKeyValue = "DataPath";

        public RemoveSQL2017(WixBootstrapper bootstrapper)
        {
            _bootstrapper = bootstrapper;
        }

        public void Remove(string bootStrapFolder, string dataFilePath)
        {
            CreateDetachSQLFile();
            CopyFiles(dataFilePath);
            UninstallSQL(bootStrapFolder);
            DeleteDBRegistryPath();
        }
        public static void UninstallSQL(string bootstrapFolder)
        {
            try
            {
                _bootstrapper.Engine.Log(LogLevel.Verbose, "Beginning UninstallSQL; bootstrapFolder=" + bootstrapFolder);
                Process process = new Process();
                ProcessStartInfo startInfo = new ProcessStartInfo(bootstrapFolder + "//SQL2017//setup.exe", UNINSTALL_SQL_2017);
                process.StartInfo = startInfo;
                process.Start();
                process.WaitForExit();
                _bootstrapper.Engine.Log(LogLevel.Verbose, "Completing UninstallSQL; bootstrapFolder=" + bootstrapFolder);
            }
            catch (Exception e)
            {
                _bootstrapper.Engine.Log(LogLevel.Verbose, "Error in UninstallSQL:\n " + e.ToString());
                throw (e);
            }
        }
        public static void CopyFiles(string dataFilePath)
        {
            try
            {
                _bootstrapper.Engine.Log(LogLevel.Verbose, "Beginning CopyFiles; dataFilePath=" + dataFilePath + "  tempDBFilePath=" + Globals.tempDBFilePath);
                File.Copy(Path.Combine(dataFilePath, Globals.MDF_FILE), Path.Combine(Globals.tempDBFilePath, Globals.MDF_FILE));
                File.Copy(Path.Combine(dataFilePath, Globals.LDF_FILE), Path.Combine(Globals.tempDBFilePath, Globals.LDF_FILE));
                _bootstrapper.Engine.Log(LogLevel.Verbose, "Completing CopyFiles; dataFilePath=" + dataFilePath + "  tempDBFilePath=" + Globals.tempDBFilePath);
            }
            catch (Exception e)
            {
                _bootstrapper.Engine.Log(LogLevel.Verbose, "Error in CopyFiles:\n " + e.ToString());
            }
        }
        public static void DetachDB(string sqlFilePath)
        {
            try
            {
                _bootstrapper.Engine.Log(LogLevel.Verbose, "Beginning DetachDB; sqlFilePath=" + sqlFilePath);
                string command = string.Format("-S .\\{0} -E -i \"{1}\"", DB_INSTANCE, sqlFilePath);
                ProcessStartInfo info = new ProcessStartInfo("sqlcmd", command);
                info.UseShellExecute = false;
                info.CreateNoWindow = false;
                info.WindowStyle = ProcessWindowStyle.Hidden;
                Process proc = new Process();
                proc.StartInfo = info;
                proc.StartInfo.RedirectStandardOutput = true;
                proc.Start();
                string outputD = proc.StandardOutput.ReadToEnd();
                if (proc.WaitForExit(COMMAND_LINE_WAIT))
                {
                    _bootstrapper.Engine.Log(LogLevel.Verbose, outputD);
                }
                else
                {
                    _bootstrapper.Engine.Log(LogLevel.Verbose, "Process timeout in DetachDb");
                }
                _bootstrapper.Engine.Log(LogLevel.Verbose, "Completing DetachDB; sqlFilePath=" + sqlFilePath);
            }
            catch (Exception e)
            {
                _bootstrapper.Engine.Log(LogLevel.Verbose, "Error in DetachDB:\n " + e.ToString());
                throw (e);
            }
        }
        public static void CreateDetachSQLFile()
        {
            try
            {
                string sqlFilePath = Path.Combine(Path.GetTempPath(), sqlFile);
                var sqlScript = new StringBuilder();
                sqlScript.AppendLine("GO");
                sqlScript.AppendLine("IF EXISTS (SELECT * FROM sysdatabases WHERE name = N'PharmSpecDB')");
                sqlScript.AppendLine("use PharmSpecDB");
                sqlScript.AppendLine("DROP SCHEMA PharmSpecUsr");
                sqlScript.AppendLine("DROP USER PharmSpecUsr");
                sqlScript.AppendLine("use master");
                sqlScript.AppendLine("EXEC sp_detach_db 'PharmSpecDB'");
                sqlScript.AppendLine("GO");
                sqlScript.AppendLine("IF EXISTS (SELECT * FROM syslogins WHERE name = N'PharmSpecUsr')");
                sqlScript.AppendLine("DROP LOGIN PharmSpecUsr");
                sqlScript.AppendLine("GO");
                using (StreamWriter sw = new StreamWriter(sqlFilePath))
                {
                    sw.Write(sqlScript.ToString());
                }
                DetachDB(sqlFilePath);
            }
            catch (Exception e)
            {
                _bootstrapper.Engine.Log(LogLevel.Verbose, "error in CreateDetachSQLFile:\n " + e.ToString());
                throw (e);
            }
        }

        public static void DeleteDBRegistryPath()
        {
            try
            {
                using (RegistryKey key = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
                {
                    RegistryKey subkey = key.OpenSubKey(registryKey, true);
                    if (subkey != null)
                    {
                        subkey.DeleteValue(subKeyValue);
                    }           
                }
            }
            catch (Exception e)
            {
                _bootstrapper.Engine.Log(LogLevel.Verbose, "error in DeleteDBRegistryPath:\n" + e.ToString());
            }
        }

我按如下方式调用此类:我能够看到 SqlServer 2017 被卸载。

 if (Bootstrapper.Engine.StringVariables["PreviousVersion"].CompareTo("3.5.99") <= 0 &&
               Bootstrapper.Engine.StringVariables["SqlInstanceKeyFound64"] == "1")
                {
                    RemoveSQL2017 removeSQL = new RemoveSQL2017(Bootstrapper);
                    removeSQL.Remove(Bootstrapper.Engine.StringVariables["DB2017SETUP"], Bootstrapper.Engine.StringVariables["2017DBDataPath"]);
                    Bootstrapper.Engine.StringVariables["OLDDBDATAPATH"] = Globals.tempDBFilePath;
                    Bootstrapper.Engine.StringVariables["INSTALLSQL"] = "1";
                }

我有一个 SqlServer.wxi,其中的注册表项和 exe 文件如下。在删除 SqlServer2017 之前,注册表中的内容如下,

註冊

sqlserver.wxi

<Variable Name="SqlInstanceKeyFound" Value="0"/>
        <Variable Name="SqlInstanceKeyFound64" Value="0"/>
<util:RegistrySearch
          Id="SqlInstanceKeyFound64"
          Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL" Value="PHARMSPEC"
          Result="exists" Variable="SqlInstanceKeyFound64" Win64="yes"/>
        <util:RegistrySearch
          Id="SqlInstanceKey64"
          Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL" Value="PHARMSPEC"
          Variable="SqlInstanceKey64" After="SqlInstanceKeyFound64" Condition="SqlInstanceKeyFound64" Win64="yes" />
        <util:RegistrySearch
          Id="SqlInstanceFound64"
          Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\[SqlInstanceKey64]"
          Result="exists" Variable="SqlInstanceFound64" After="SqlInstanceKey64" Condition="SqlInstanceKeyFound64" Win64="yes" />
        <util:RegistrySearch
          Id="SqlVersion64"
          Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\[SqlInstanceKey64]\Setup" Value="Version"
          Variable="SqlVersion64" After="SqlInstanceKey64" Condition="SqlInstanceFound64" Win64="yes" />

 <PackageGroup Id="SQL2022Express">
      <ExePackage Id="SQL2022Express"
              DisplayName="SQL Server 2022 Express"
              Cache="yes"
              Compressed="no"
              PerMachine="yes"
              Permanent="no"
              Vital="yes"
              DetectCondition="SqlInstanceFound64"
              InstallCondition="INSTALLSQL=1"
              Name="Redist\SQLEXPR_x64_!(loc.LANG).exe"
              SourceFile="$(var.DependencyFolder)\SQLEXPR_x64_!(loc.LANG).exe"
              InstallCommand="/ACTION=Install /IACCEPTSQLSERVERLICENSETERMS [SQLQUIET] /HIDECONSOLE /FEATURES=SQLEngine /UpdateEnabled=0 /INSTANCENAME=PHARMSPEC /SQLSYSADMINACCOUNTS=Builtin\Administrators /SQLSVCACCOUNT=&quot;NT AUTHORITY\NETWORK SERVICE&quot; /SECURITYMODE=SQL /SAPWD=[SAPASSWORD] /NPENABLED=1 /TCPENABLED=1 /SKIPRULES=RebootRequiredCheck"
              UninstallCommand="/Action=Uninstall /INSTANCENAME=PHARMSPEC /FEATURES=SQL /QS /HIDECONSOLE">
        <ExitCode Value ="3010" Behavior="forceReboot" />
      </ExePackage>
    </PackageGroup>

日志中显示以下内容:

  • [0EE8:0EEC][2024-11-08T14:09:13]i000:将数字变量“SqlInstanceFound64”设置为值 1
  • [0EE8:0EEC][2024-11-08T14:09:13]i052:条件“SqlInstanceFound”计算结果为假。
  • [0EE8:0EEC][2024-11-08T14:09:13]i052:条件“SqlInstanceFound64”计算结果为真。
  • [0EE8:0EEC][2024-11-08T14:09:13]i000:将字符串变量“SqlVersion64”设置为值“14.0.1000.169”
  • [0EE8:0EEC][2024-11-08T14:09:13]i101:检测到的包:SQL2022Express,状态:存在,缓存:无
  • [0EE8:0EEC][2024-11-08T14:09:29]i052:条件“INSTALLSQL = 1”计算结果为真。
  • [0EE8:0EEC][2024-11-08T14:09:29]w321:跳过没有依赖提供程序的包的依赖项注册:SQL2022Express
  • [0EE8:0EEC][2024-11-08T14:09:29]i052:条件“INSTALLSQL = 0”计算结果为假。
wix
  • 1 个回答
  • 11 Views
Martin Hope
ElDog
Asked: 2023-08-17 16:10:31 +0800 CST

WiX 4 安装程序中引用多目标 C# 项目,未找到绑定名称

  • 5

我有一个为 net Framework 4.7.2 和 net 7.0 构建的多目标 C# 项目。项目的 TargetFrameworks 元素设置为:

<TargetFrameworks>net472;net7.0-windows</TargetFrameworks>

现在我需要将 net Framework 和 net 7 构建输出包含到我的安装程序(不同的文件夹)中。

我尝试按照 WiX 讨论中描述的步骤进行操作: https://github.com/wixtoolset/issues/issues/7241

最初,我按照那里描述的“旧”方式进行操作:在 wixproj 中,我插入 2 个项目引用,并显式指定了不同的 BindName:

<ProjectReference Include="..\MyProject\MyProject.csproj" SetTargetFramework="TargetFramework=net472" BindName="MyProject.net472"/>
<ProjectReference Include="..\MyProject\MyProject.csproj" SetTargetFramework="TargetFramework=net7.0-windows" BindName="MyProject.net7.0-windows"/>

然后在 wxs 文件中我将文件包含在组件中:

...
<File Id="MyFile" Name="MyProject.dll" Source="!(bindpath.MyProject.net472)\MyProject.dll" />
...
<File Id="MyFile" Name="MyProject.dll" Source="!(bindpath.MyProject.net7.0-windows)\MyProject.dll" />

这似乎有效。文件已找到并打包。但它需要 wixproj 文件中的 2 个 ProjectReference 条目。按照 WiX 讨论中描述的方式,应该可以只添加一个:

<ProjectReference Include="..\MyProject\MyProject.csproj" TargetFrameworks="net472,net7.0-windows"/>

它应该自动生成 BindName。

但是,在我这样做之后,找到了具有 MyProject.net472 绑定路径的文件,但没有找到具有 MyProject.net7.0-windows 绑定路径的文件。最后我也尝试了不加-windows,结果是一样的。怎么了?

wix
  • 1 个回答
  • 16 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    重新格式化数字,在固定位置插入分隔符

    • 6 个回答
  • Marko Smith

    为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会?

    • 2 个回答
  • Marko Smith

    VScode 自动卸载扩展的问题(Material 主题)

    • 2 个回答
  • Marko Smith

    Vue 3:创建时出错“预期标识符但发现‘导入’”[重复]

    • 1 个回答
  • Marko Smith

    具有指定基础类型但没有枚举器的“枚举类”的用途是什么?

    • 1 个回答
  • Marko Smith

    如何修复未手动导入的模块的 MODULE_NOT_FOUND 错误?

    • 6 个回答
  • Marko Smith

    `(表达式,左值) = 右值` 在 C 或 C++ 中是有效的赋值吗?为什么有些编译器会接受/拒绝它?

    • 3 个回答
  • Marko Smith

    在 C++ 中,一个不执行任何操作的空程序需要 204KB 的堆,但在 C 中则不需要

    • 1 个回答
  • Marko Smith

    PowerBI 目前与 BigQuery 不兼容:Simba 驱动程序与 Windows 更新有关

    • 2 个回答
  • Marko Smith

    AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String”

    • 1 个回答
  • Martin Hope
    Fantastic Mr Fox msvc std::vector 实现中仅不接受可复制类型 2025-04-23 06:40:49 +0800 CST
  • Martin Hope
    Howard Hinnant 使用 chrono 查找下一个工作日 2025-04-21 08:30:25 +0800 CST
  • Martin Hope
    Fedor 构造函数的成员初始化程序可以包含另一个成员的初始化吗? 2025-04-15 01:01:44 +0800 CST
  • Martin Hope
    Petr Filipský 为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会? 2025-03-23 21:39:40 +0800 CST
  • Martin Hope
    Catskul C++20 是否进行了更改,允许从已知绑定数组“type(&)[N]”转换为未知绑定数组“type(&)[]”? 2025-03-04 06:57:53 +0800 CST
  • Martin Hope
    Stefan Pochmann 为什么 {2,3,10} 和 {x,3,10} (x=2) 的顺序不同? 2025-01-13 23:24:07 +0800 CST
  • Martin Hope
    Chad Feller 在 5.2 版中,bash 条件语句中的 [[ .. ]] 中的分号现在是可选的吗? 2024-10-21 05:50:33 +0800 CST
  • Martin Hope
    Wrench 为什么双破折号 (--) 会导致此 MariaDB 子句评估为 true? 2024-05-05 13:37:20 +0800 CST
  • Martin Hope
    Waket Zheng 为什么 `dict(id=1, **{'id': 2})` 有时会引发 `KeyError: 'id'` 而不是 TypeError? 2024-05-04 14:19:19 +0800 CST
  • Martin Hope
    user924 AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String” 2024-03-20 03:12:31 +0800 CST

热门标签

python javascript c++ c# java typescript sql reactjs html

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve