Visual Studio 构建和部署顺序
我们有一个 VS 2010 解决方案,其中包括一些类库项目、一个 SQL Server 2008 数据库项目和一个 Wix 安装项目。我们试图达到以下目标:
- 构建类库项目和数据库项目
- 部署数据库项目以生成部署 .sql 脚本
- 构建 Wix 安装项目。
所需顺序的原因是安装项目需要部署 .sql 脚本,因为它将使用这些脚本在运行 msi 的计算机上生成/更新数据库。
似乎 Visual Studio 解决方案文件中无法创建这种类型的构建/部署/构建顺序。这是正确的吗?
谢谢
We have a VS 2010 solution that includes a few class library projects, a SQL Server 2008 database project and a Wix setup project. We are trying to get to a point where the following happens in the order specified:
- Build the class library projects and the database project
- Deploy the database project to generate the deploy .sql script
- Build the Wix setup project.
The reason for the desired order is that the setup project requires the deployment .sql scripts as it will use these to generate/update the database on the machine that the msi is run.
It seems that there is no way within a Visual Studio solution file to create this type of build/deploy/build order. Is this correct?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以更改 Wix 项目 (
*.wixproj
) 的BeforeBuild
目标,以在构建之前部署数据库项目:You could change the
BeforeBuild
target of the Wix project (*.wixproj
) to deploy the database project before the build:你如何建造它?您可以从 Visual Studio 更改解决方案中的生成顺序,从而允许您从 Visual Studio 生成它。在“解决方案资源管理器”中,转到“构建顺序”等。
如果您从命令行/MSBUILD 执行此操作,您可以构建第一个、第二个和最后一个项目,很简单,只需按照所需的顺序在每个项目上调用 MSBUILD 即可。我认为应该有更精细的控制,我不记得了。
编辑:它称为“项目构建顺序”,位于解决方案节点下,当解决方案中有超过 1 个项目时它会激活。
How are you building it? You can change the build order in a solution from Visual Studio, granting you build it from Visual Studio. In Solution Explorer go to Build Order or so.
If you do it from command-line/MSBUILD you can build the first, then the second and the last project, easy, just call MSBUILD on each project, in the desired order. Thought there should be a finer control, I don't remember.
EDIT: It's called "Project Build Order", under the the solution node, it activates when you have more than 1 project in the solution.
我尝试过此操作,但在编辑后尝试重新加载项目时出现错误。然而,忽略错误并再次重新加载项目效果很好,并且构建 Wix 项目确实会触发数据库项目的部署。
I have tried this and get an error when I tried to reload the project after editing. However ignoring the error and reloading the project again worked fine and indeed building the Wix project triggers a deploy of the database project.