建设项目维克斯安装程序 [英] Build project for Wix installer

查看:115
本文介绍了建设项目维克斯安装程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建一个维克斯安装程序为我们的应用程序。因为它仅复制主exe文件维克斯项目收获不起作用的安装目录,所有的DLL等都是不可复制的。

I'm trying to create a Wix installer for our app. Wix Project harvest does not work since it only copies the main exe file to the install dir, all dll's etc are not copied.

所以,我想有一个pre生成事件是构建应用程序和使用,输出维克斯的。

So I was thinking of having a pre build event that builds the app and use that output from Wix.

现在的问题是,输出具有类似的.pdb文件,vchost.exe等我可以配置的构建,使其只输出所需的文件?

The problem is that the output will have files like .pdb, vchost.exe etc. Can I configure the build so that it only outputs the needed files?

编辑:最终解决方案,可以在这里找到 https://github.com/AndersMalmgren/FreePIE/blob/master/BuildTools

首先,在寻找 的https://github.com/AndersMalmgren/FreePIE/blob/master/BuildTools/build_installer.bat

推荐答案

当我创建任何类型的安装程序/ zip文件/无论我的项目,我从来没有这样做,在标准建立在Visual Studio中,即在 .csproj的文件。
(我知道这就是你正在试图把pre生成事件 - 正确的)
原因是,我不希望在重建的每一个版本的安装人员/ ZIP,我做的,而我编程。

When I create any type of installer/zip file/whatever for my projects, I never do that in the "standard" build in Visual Studio, i.e. in the .csproj file.
(I understand that's where you are trying to put the pre build event - correct?)
The reason is that I don't want to rebuild the installer/zip on every single build that I do while I'm programming.

我总是这样:
我创建了一个 MSBuild项目文件,我可以从资源管理器中的(通常是通过手动执行批处理文件)的,它编译Visual Studio解决方案,然后创建一个zip文件,安装人员的NuGet包或任何我所需要的。
因此,创建安装完全脱离Visual Studio解决方案,但我可以从源头控制拉的最新变化,然后建立的一切,并创建一个单一的点击安装。
乔尔测试,第二个问题:你能不能做出一个建立在一个步骤)

What I always do:
I create a MSBuild project file that I can execute manually from the explorer (usually via batch file), which compiles the Visual Studio solution and then creates zip files, installers, NuGet packages or whatever I need.
So creating the setup is completely out of the Visual Studio solution, but I can pull the latest changes from source control and then build everything and create the setup with one single click.
(Joel Test, second question: "Can you make a build in one step?")

当我不需要一切,Visual Studio中提出到输出文件夹,我只是复制我首先需要一个不同的文件夹中的文件。

When I don't need everything that Visual Studio puts into the output folder, I just copy the files I need to a different folder first.

下面是我的一个项目为例:

  1. <一个href="https://bitbucket.org/christianspecht/bitbucket-backup/src/680755dd2438/build.proj?at=default">The的MSBuild文件
    最后一段(文件拷贝到release文件夹)复制 \ BIN \发布文件夹中的内容(但不包括 *。PDB * XML 文件),并从根文件夹中的一些文件到一个单独的释放目录:

  1. The MSBuild file
    The last paragraph ("copy files to release folder") copies the content of the \bin\Release folder (but excluding *.pdb and *.xml files) and some files from the root folder to a separate "release" directory:

<!-- copy files to release folder -->
<Target Name="CopyRelease">
        <MakeDir Directories="$(ReleaseDir)"/>
        <ItemGroup>
                <ReleaseFiles
                        Include="$(OutDir)\**\*.*;
                                README.md;
                                License.rtf"
                        Exclude="$(OutDir)\*.pdb;
                                $(OutDir)\*.xml">
                </ReleaseFiles>
        </ItemGroup>
        <Copy SourceFiles="@(ReleaseFiles)" DestinationFiles="@(ReleaseFiles -> '$(ReleaseDir)\%(RecursiveDir)%(Filename)%(Extension)')"/>

</Target>

  • <一个href="https://bitbucket.org/christianspecht/bitbucket-backup/src/680755dd2438/build.bat?at=default">The我用它来执行的MSBuild文件
    批处理文件 还有更多的code中的批处理文件中的(照顾的东西,如版本号)的,但如果我执行的MSBuild文件中的重要组成部分,是这样的:

  • The batch file that I use to execute the MSBuild file
    There is more code in the batch file (to take care of stuff like version numbers), but the important part where I execute the MSBuild file is this:

    rem path to msbuild.exe
    path=%path%;%windir%\Microsoft.net\Framework\v4.0.30319
    
    rem go to current folder
    cd %~dp0
    
    msbuild build.proj
    

  • 我在实际使用维克斯建设安装这个项目,但我不使用您正在使用的收获的功能(我不知道它之前)。
    我只是指定的每一个文件中的<一个安装程序href="https://bitbucket.org/christianspecht/bitbucket-backup/src/680755dd24384c7eed95bc29da614fddd0af9e75/wix/bitbucket-backup.wxs?at=default">WiX项目文件,然后我用<一个href="https://bitbucket.org/christianspecht/bitbucket-backup/src/680755dd2438/build-setup.bat?at=default">another批处理文件的(通过调用上面提到的第一个批处理文件)的再WiX的安装程序。


    I'm actually using WiX to build the installer for this project, but I don't use the "harvest" feature that you are using (I didn't know about it before).
    I just specify every single file for the installer in the WiX project file, and then I use another batch file to build the project (by calling the first batch file mentioned above) and then the WiX setup.

    即使我使用实际的WiX工具是比你不同,你仍然可以使用类似的方法像一个如上所述打造的源文件夹的维克斯的收获特点:
    呼叫拷贝正是你需要一个不同的文件夹中的文件的批处理文件,并使用作为创建安装程序的源代码。
    如果你不希望创建的MSBuild文件,你甚至可以使用类似的Robocopy (它能够反映一个完整的文件夹,但排除某些文件扩展名)。

    Even if my usage of the actual WiX tool is different than yours, you could still use a similar approach like the one explained above to create the "source folder" for WiX's harvest feature:
    Call a batch file that copies exactly the files you need to a different folder, and use that as the source to create the installer.
    If you don't want to create a MSBuild file, you can even use something like Robocopy (which is able to mirror a complete folder, but exclude certain file extensions).

    编辑:

    1. 尝试,而不只是一个项目,以建立自己的完整的解决方案。
      将一个批处理文件,你的的.sln 文件夹中的内容如下:

    1. Try to build your complete solution, instead of just one project.
      Put a batch file with the following content in the folder where your .sln file is:

    set PATH=%PATH%;%WINDIR%\Microsoft.Net\Framework64\v4.0.30319
    
    rem go to current folder
    cd %~dp0
    
    msbuild YourSolution.sln /p:Configuration=Release
    

  • 第二个错误说了一些关于 preBuildEvent目标
    - >您已经把东西进入的pre生成事件的 .csproj的?也许这是行不通的。

  • The second error says something about a PreBuildEvent target
    --> Did you already put something into the pre build event of your .csproj? Maybe that doesn't work.

    EDIT2:

    我在做类似的事情:
    我只是有一个<一个href="https://bitbucket.org/christianspecht/bitbucket-backup/src/680755dd2438/wix/version_number.bat?at=default">batch文件,来把版本号(这是很难codeD在我的情况),到一个环境变量,我呼吁从我的<一个该批处理文件href="https://bitbucket.org/christianspecht/bitbucket-backup/src/680755dd2438/build.bat?at=default">main这样做的实际构建之前建立一批。
    在我的 .csproj的,我有一个<一个href="https://bitbucket.org/christianspecht/bitbucket-backup/src/680755dd24384c7eed95bc29da614fddd0af9e75/src/BitbucketBackup/BitbucketBackup.csproj?at=default#cl-124">$p$p-build事件的设置程序集的版本号从如果它存在的环境变量的值,否则只是 0.0
    (我不关心的版本号,当我从Visual Studio构建 - 我创建所有发行版本的批处理文件,所以我只需要在那里的版本号)

    I'm doing something similar:
    I just have a batch file that puts the version number (which is hardcoded in my case) into an environment variable, and I call that batch file from my main build batch before doing the actual build.
    In my .csproj, I have a pre-build event that sets the assembly version number to the value from the environment variable if it exists, otherwise just to 0.0.
    (I don't care about the version number when I build from Visual Studio - I create all release builds with the batch file, so I only need the version number there)

    修改3:

    最后一步,让整个输出到维克斯,您链接的每个文件,多数民众赞成在多亩的项目不practicle。它的几个子文件夹和文件的千元。如何在WiX的链接的整个输出文件夹的任何好主意吗?

    Last step, get the entire output into Wix, you link each file, thats not practicle in mu project. its several sub folders, and thousand of files. Any good idea on how to link the entire output folder in wix?

    对不起,我从来没有尝试过这一点。使用WiX的正确的方法将是从头。

    Sorry, I never tried this before. The right way using WiX would have been to build the setup incrementally right from the beginning.

    报价从链路(重点由我):

    Quote from the link (emphasis by me):

    打字组件的所有那些数百或数千到维克斯   源文件presents另一种挑战,当然。该工具有一个   <一href="http://wix.tramontana.co.hu/tutorial/com-ex$p$pssion-syntax-miscellanea/components-of-a-different-color">small实用,可以帮助这个(更多关于它以后),但   真正的解决方案是一种观念上的改变。 停止审批设置   程序为具有被写入在匆忙一个单独的应用程序   当主应用程序已经完成。由于维克斯源文件   而工具本身可以集成到您的开发   环境很容易,你应该让他们在同步所有的时间。尽快   当你开始工作一个新的模块或添加一个新的注册表引用   你的程序,修改相应的WiX源文件在同一   时间通过这种方式,设置将被一起完   应用程序本身和不会有需要提取的所有文件   和所需的其它信息进行安装后。   由于维克斯项目可模块化(后面会详细讲解),这   方法效果一样好,如果你有一个大的团队工作的   应用程序,而不是一个单一的开发。

    Typing all those hundreds or thousands of components into the WiX source file presents another challenge, of course. The toolset has a small utility that can help with this (more about it later) but the real solution is a conceptual change. Stop considering the setup program as a separate application that has to be written in a rush when the main application is already finished. As the WiX source files and the toolset itself can be integrated into your development environment easily, you should keep them in sync all the time. As soon as you start working on a new module or add a new registry reference to your program, modify the corresponding WiX source file at the same time. This way, the setup will be finished together with the application itself and there will be no need to extract all the file and other pieces of information required for the installation later. As the WiX project can be modularized (more about this later), this approach works just as well if you have a large team working on the application rather than a single developer.

    的<一个href="http://wix.tramontana.co.hu/tutorial/com-ex$p$pssion-syntax-miscellanea/components-of-a-different-color">link在引用文本指向一个页面描述工具,这似乎是你以前提到的,并已经尝试没有成功的收获的工具。

    The link in the quoted text points to a page describing the Heat tool, which seems to be the "harvest" tool that you mentioned before and already tried without success.

    这篇关于建设项目维克斯安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆