如何使用 msbuild 自动构建 vs2005 网站?

发布于 2024-12-02 07:05:42 字数 653 浏览 4 评论 0原文

我正在使用旧的 Visual Studio 2005 网站(不是 Web 应用程序项目)。当前的目标是将我们的手动流程复制为自动化构建的一部分。目前我无法选择升级项目、创建 Web 部署项目或将其更改为 Web 应用程序项目。

当前流程的最简单视图是,开发人员将在他的盒子上构建解决方案,将网站发布到他的盒子上的某个位置,将其压缩并将其交给发布团队。

我现在不打算更改此过程的输出,只是将其自动化作为我们的 msbuild 脚本的一部分。

到目前为止,我得到的最接近的是使用 AspNetCompiler 任务,如下所示:

<AspNetCompiler
  PhysicalPath="website\"
  TargetPath="output\"
  VirtualPath="/"
  Force="true"
  Debug="true"
  />

但是,这会导致几个错误,例如 error CS0246: The type or namespace name 'FOO' Could not be find (are you miss a using 指令或者程序集引用?)


编辑:

我应该之前提到过这一点,但是在具有重建目标的解决方案上运行 msbuild 会给出相同的结果。

I'm working with an old visual studio 2005 web site (not web application project). The current goal is to replicate our manual process as part of our automated builds. It is not currently an option for me to upgrade the project, create a web deployment project, or to change it to a web application project.

The simplest view of the current process is that a developer will build the solution on his box, publish the website to a location on his box, zip it up and hand it off to the release team.

I'm not looking to change the output of this process right now, just to automate it as part of our msbuild scripts.

The closest I've gotten so far is to use the AspNetCompiler task like this:

<AspNetCompiler
  PhysicalPath="website\"
  TargetPath="output\"
  VirtualPath="/"
  Force="true"
  Debug="true"
  />

However, this results in several errors like error CS0246: The type or namespace name 'FOO' could not be found (are you missing a using directive or an assembly reference?)


EDIT:

I should have mentioned this before but running msbuild on the solution with the rebuild target gives the same result.

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

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

发布评论

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

评论(3

我不在是我 2024-12-09 07:05:43

我宁愿使用 MSBuild.exe 本身 - (1) build &发布并将发布目录设置为目标文件夹或 (2) 构建和 xcopy bin 文件夹、aspx/asmx/svc 文件和配置(假设您在目标计算机上的 IIS 中配置了网站)。

I would rather use MSBuild.exe itself - either (1) build & publish with publish directory set to your destination folder OR (2) build and xcopy bin folder, aspx/asmx/svc files and config (assuming you have the Website configured at IIS on your destination machine).

亣腦蒛氧 2024-12-09 07:05:43

I once described how to use a combination of aspnet_compiler and aspnet_merge for this scenario.

狼亦尘 2024-12-09 07:05:43

在我看来,该错误实际上与您的项目无法编译这一事实有关,而不是与您的 MSBuild 问题有关。

要么是这样,要么您使用的是较低版本的编译器(通常是当它开始播放明显存在的引用时)。

确保您使用的 MSBuild 版本与您在项目中使用的版本相匹配。

It looks to me like the error is actually related to the fact that your project won't compile, rather than an issue with your MSBuild.

Either that or you are using a lower version of the compiler (that's usually when it starts playing up about references that are clearly there).

Make sure you are using the appropriate version of MSBuild that matches the version you are using in your project.

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