首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在wixsharp中为项目指定自定义许可文件

在wixsharp中为项目指定自定义许可文件
EN

Stack Overflow用户
提问于 2015-09-26 17:35:38
回答 1查看 954关注 0票数 3

首先,我是WixSharp的新手。几个小时以来,我一直在尝试为我的安装项目指定一个自定义文件License.rtf,如下所示:

代码语言:javascript
复制
project.LicenceFile = "License.rtf";

但是我一直收到这个错误:

代码语言:javascript
复制
C# Script execution engine. Version 3.9.4.1.
Copyright (C) 2004-2014 Oleg Shilo.

Error: Specified file could not be executed.

System.Xml.XmlException: The prefix '' cannot be redefined from 'http://schemas. microsoft.com/wix/2006/wi' to '' within the same start element tag.
at System.Xml.XmlWellFormedWriter.PushNamespaceExplicit(String prefix, String ns)
at System.Xml.XmlWellFormedWriter.WriteEndAttribute()
at System.Xml.Linq.ElementWriter.WriteStartElement(XElement e)
at System.Xml.Linq.ElementWriter.WriteElement(XElement e)
at System.Xml.Linq.XElement.WriteTo(XmlWriter writer)
at System.Xml.Linq.XContainer.WriteContentTo(XmlWriter writer)
at System.Xml.Linq.XDocument.WriteTo(XmlWriter writer)
at System.Xml.Linq.XDocument.Save(TextWriter textWriter, SaveOptions options)

at WixSharp.Compiler.BuildWxs(Project project, String path, OutputType type)
at WixSharp.Compiler.BuildWxs(Project project, OutputType type)
at WixSharp.Compiler.Build(Project project, String path, OutputType type)
at WixSharp.Compiler.Build(Project project, OutputType type)
at Script.Main(String[] args)

有人能告诉我我哪里做错了吗?下面是我的setup.cs代码:

代码语言:javascript
复制
//css_dir ..\..\;
//css_ref Wix_bin\SDK\Microsoft.Deployment.WindowsInstaller.dll;
//css_ref System.Core.dll;
using System;
using System.Xml;
using System.Xml.Linq;
using System.Linq;
using System.Windows.Forms;
using Microsoft.Deployment.WindowsInstaller;
using Microsoft.Win32;
using WixSharp;
using WixSharp.CommonTasks;

class Script
{
static public void Main(string[] args)
{
    var project =

        new Project("myproduct",
            new Dir(@"%ProgramFiles%\My Company\myproduct", new DirFiles(@"Files\*.*"), 
        new Dir("DataModel", new DirFiles(@"Files\Data\*.*"),new Dir("Music", new DirFiles(@"Files\Data\Music\*.*")),new Dir("CardPack", new DirFiles(@"Files\Data\CardPack\*.*")),new Dir("CardSingle", new DirFiles(@"Files\Data\CardSingle\*.*"))),
                    new ExeFileShortcut("Uninstall MyProduct", "[System64Folder]msiexec.exe", "/x [ProductCode]")), 
    new Dir(@"%AppDataFolder%\myproduct", new File(@"Files\Config\Configure.json"), new Dir("Folder1", new DirFiles(@"Files\Folder2\*.*"))));
    project.LicenceFile = "License.rtf";
    project.UI = WUI.WixUI_Minimal;
    project.GUID = new Guid();

    project.ResolveWildCards();

    var exeFile = project.AllFiles.Single(f=>f.Name.EndsWith("myproduct.exe"));

    exeFile.Shortcuts = new[] { 
                                new FileShortcut("myproduct.exe", "INSTALLDIR"),
                                new FileShortcut("myproduct.exe", @"%Desktop%")
                              };

    Compiler.BuildMsi(project);
}
}

提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2016-04-03 06:29:05

不知道您是否找到了问题的答案,但是Orca是一个包含在Windows SDK中的MSI表编辑器。

对于Windows7和.NET 3.5 SP1 - https://www.microsoft.com/en-us/download/confirmation.aspx?id=3138

安装完成后,导航到C:\Program Files\Microsoft \Windows7.0\Bin并执行orca.msi。然后,您将运行Wix#项目以生成msi文件。使用Orca打开msi文件并导航到二进制表。双击WixSharp_LicenseFile的数据列,您将看到一个读取或写入文件的选项。如果要查看内容,请选择一个文件名(.rtf格式)并写入文件。根据需要进行任何更改,或替换该文件,然后使用它读取该二进制数据行。将其读入msi表后,保存msi文件并关闭。

我自己是WixSharp的新手,所以我还没有找到另一种方法(还没有!),但这个方法对我来说是有效的。

祝好运!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32795696

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档