Visual Studio 构建和部署顺序

发布于 2024-09-01 23:41:20 字数 308 浏览 0 评论 0原文

我们有一个 VS 2010 解决方案,其中包括一些类库项目、一个 SQL Server 2008 数据库项目和一个 Wix 安装项目。我们试图达到以下目标:

  1. 构建类库项目和数据库项目
  2. 部署数据库项目以生成部署 .sql 脚本
  3. 构建 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:

  1. Build the class library projects and the database project
  2. Deploy the database project to generate the deploy .sql script
  3. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

同展鸳鸯锦 2024-09-08 23:41:20

您可以更改 Wix 项目 (*.wixproj) 的 BeforeBuild 目标,以在构建之前部署数据库项目:

  <ItemGroup>
    <DatabaseProject Include="../Database1/Database1.dbproj"/>
  </ItemGroup>

  <Target Name="BeforeBuild">
    <MSBuild Projects="@(DatabaseProject)" 
             Targets="Deploy"
             Properties="Configuration=$(Configuration);Platform=$(Platform)"/>
  </Target>

You could change the BeforeBuild target of the Wix project (*.wixproj) to deploy the database project before the build:

  <ItemGroup>
    <DatabaseProject Include="../Database1/Database1.dbproj"/>
  </ItemGroup>

  <Target Name="BeforeBuild">
    <MSBuild Projects="@(DatabaseProject)" 
             Targets="Deploy"
             Properties="Configuration=$(Configuration);Platform=$(Platform)"/>
  </Target>
路弥 2024-09-08 23:41:20

你如何建造它?您可以从 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.

衣神在巴黎 2024-09-08 23:41:20

我尝试过此操作,但在编辑后尝试重新加载项目时出现错误。然而,忽略错误并再次重新加载项目效果很好,并且构建 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文