MSBuild、VS2008 解决方案和 CI - 最佳实践是什么?

发布于 2024-08-06 04:06:09 字数 577 浏览 1 评论 0原文

我正在为 VS2008/C# 桌面项目设置 CI 系统,没什么花哨的,只是一个构建/测试周期。 CI 将使用 MSBuild/MSTest 在 Hudson 下运行,但我似乎无法决定如何做一些事情,也许你可以帮助我?

我在 CI 中运行项目的选项是:

  • 直接从 MSBuild 运行 .sln
  • 直接从 MSBuild 运行 .csproj
  • 创建一个单独的 MSBuild 项目,将 .sln 或 .csproj 作为 MSBuild 任务引用
  • 创建一个单独的 MSBuild 项目,导入一些内容(属性组或项目组) 如果

我不需要运行测试,我很可能只使用第一个选项(使用 MSBuild 运行 .sln)。但我需要添加一个任务来运行测试,所以我似乎无法决定是否应该将任务/目标添加到 .csproj 中还是在单独的项目中执行。我想要实现的一件事是,当我更改 .sln 或 .csproj 之一时,理想情况下我不必接触任何其他内容就能够在 CI 中继续成功运行。

另一个问题是关于运行 MSTest - Exec 任务是否足够,或者我应该编写/使用一些 MSTest 任务(似乎在 .Net 上找不到)

I am setting up a CI system for VS2008/C# desktop project, nothing fancy, just a build/test cycle. CI will be running under Hudson using MSBuild/MSTest, but I can't seem to decide on a how to do a few things, maybe you can help me out?

My options for running the project in the CI are:

  • Run the .sln directly from MSBuild
  • Run the .csproj directly from MSBuild
  • Create a separate MSBuild project referencing the .sln or .csproj as an MSBuild task
  • Create a separate MSBuild project importing some stuff (property groups or item groups)
    from the .csproj

If I wouldn't need to run tests, I would most probably just used the 1st option (run the .sln with MSBuild). But I need to add a task for running the tests, so I can't seem to decide if I should add the task/target to the .csproj's or do it in a separate project. One thing I want to achieve is that when I change my .sln or one of the .csproj, ideally I shouldn't have to touch anything else to be able to keep running successfully in the CI.

Another question is around running the MSTest - is Exec task sufficient or should I write/use some MSTest task (can't seem find one on the .Net)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

弱骨蛰伏 2024-08-13 04:06:09

测试任务是 .NEt 3.5 Framework 中 MSBuild 的内置任务,代码覆盖率也是如此。只需在 MSDN 上搜索 BeforeTest 和 CoreTest-targets 即可。不是很难,只需包括类似的内容:

   <ItemGroup>
      <TestContainer Include="$(OutDir)\BuildTestProject.dll" />
   </ItemGroup>

   <ItemGroup>
      <MetaDataFile Include="$(SolutionRoot)\BuildTest.vsmdi" />
   </ItemGroup>

   <PropertyGroup>
      <RunConfigFile>$(SolutionRoot)\LocalTestRun.testrunconfig</RunConfigFile>
   </PropertyGroup>

应该可以..

The Test task is a built-in task for MSBuild in .NEt 3.5 Framework, as is code coverage. Just search on the BeforeTest and CoreTest-targets on MSDN. Not very hard, just include something like:

   <ItemGroup>
      <TestContainer Include="$(OutDir)\BuildTestProject.dll" />
   </ItemGroup>

   <ItemGroup>
      <MetaDataFile Include="$(SolutionRoot)\BuildTest.vsmdi" />
   </ItemGroup>

   <PropertyGroup>
      <RunConfigFile>$(SolutionRoot)\LocalTestRun.testrunconfig</RunConfigFile>
   </PropertyGroup>

should work..

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