[英]Can an msi-installer be created using MSBuild + .csproj-file?
For anyone using Visual Studio Express, who doesn't have the setup and deployment project template, can the .csproj file be used to easily create an msi installer? 对于使用Visual Studio Express但没有设置和部署项目模板的人,可以使用.csproj文件轻松创建msi安装程序吗? I've read (can't find the link now) that a csproj file can be used by MSBuild (It gets converted to an MSBuild project file by MSBuild) - so what is the need for InstallShield, WIX, or the setup and deployment project?
我读过(现在找不到链接)一个的csproj文件可以通过的MSBuild(它被转换到由 MSBuild的MSBuild项目文件)使用-究竟什么是需要的InstallShield,维克斯,或安装和部署项目?
I realize this might be a simple question, but searching the web just turns up explanations why MSBuild is needed - and that's included in the framework itself. 我意识到这可能是一个简单的问题,但在网上搜索只是解释了为什么需要MSBuild - 而且它包含在框架本身中。
First a few clarifications: 首先澄清几点:
An alternative to Visual Studio is SharpDevelop. Visual Studio的另一种选择是SharpDevelop。 It provides its own WiX project templates.
它提供了自己的WiX项目模板。
You can also create a WiX project from scratch by hand, as explained in the documentation. 您也可以手动创建WiX项目,如文档中所述。
It is easy to create a simple MSI installer, with explicit lists of files. 使用明确的文件列表可以轻松创建简单的MSI安装程序。 You can also "harvest" .csproj outputs and some other Visual Studio project outputs, as well as directories, etc.
您还可以“收获”.csproj输出和一些其他Visual Studio项目输出,以及目录等。
Most any editor, including Visual Studio Express, will help you edit WiX project and source files as XML. 大多数编辑器(包括Visual Studio Express)都可以帮助您将WiX项目和源文件编辑为XML。 You might need to tell it where the relevant XML Schema files (.xsd) are to get content assistance.
您可能需要告诉它相关的XML Schema文件(.xsd)在哪里获得内容帮助。 The zipped binary distribution of WiX might be simplest to use in such scenarios.
在这种情况下,WiX的压缩二进制分发可能最简单。
Windows Installer is very complex. Windows Installer非常复杂。 The WiX Toolset allows full access to that complexity while attempting to kept it as simple as possible.
WiX工具集允许完全访问该复杂性,同时尽量使其保持简单。 Using WiX means learning at least some of Windows Installer.
使用WiX意味着至少学习一些Windows Installer。
Ultimately, no installer tool can look at your programming project and decide for you which files you want to ship and where to put them. 最终,没有任何安装程序工具可以查看您的编程项目,并决定您要发送哪些文件以及放置它们的位置。 So, no, you can't design and build an MSI simply by referencing a .csproj.
所以,不,你不能简单地通过引用.csproj来设计和构建MSI。
I think WiX would be the best option here. 我认为WiX将是最好的选择。 Building installer using Wix is basically a simple call to candle.exe and then light.exe so it can be automated in custom MSBuild target inside of your .csproj without any problem.
使用Wix构建安装程序基本上是对candle.exe和light.exe的简单调用,因此它可以在.csproj内的自定义MSBuild目标中自动执行,没有任何问题。
It would require however to set the environment that .wixproj projects usually do. 但是,需要设置.wixproj项目通常所做的环境。 For example, you would need to locate WixSDK to use candle/light binaries and pass $(OutputPath) property to candle.exe so that output files could be used in your .wxs .
例如,您需要找到WixSDK以使用蜡烛/灯光二进制文件并将$(OutputPath)属性传递给candle.exe,以便可以在.wxs中使用输出文件。
After all, there would be a target like this that starts the installer build: 毕竟,会有一个这样的目标启动安装程序构建:
<Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release'">
<Exec Command="$(candleExecutable) product.wxs" />
<Exec Command="$(lightExecutable) product.wixobj" />
</Target>
You could also add a condition to this target so that it's called on a specific configuration only. 您还可以向此目标添加条件,以便仅在特定配置上调用它。
No, I don't believe there's any way to do that with Express. 不,我不相信Express有任何办法可以做到这一点。 It's not a built-in feature, and you can't use add-ins with Express.
它不是内置功能,您不能使用Express加载项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.