如何使用 Nant 构建 .NET 网站

发布于 2024-07-26 21:52:55 字数 326 浏览 5 评论 0原文

我通常在 Visual Studio 中使用 Web 应用程序,Nant 中的 MSBUILD 任务可以毫无问题地构建它们:

<msbuild project="MySolution.sln">
  arg value="/property:Configuration=release" />
</msbuild> 

我现在在 VS 解决方案中有一个网站(不是 Web 应用程序),但它无法构建 - 我收到很多命名空间错误。

即使它包含网站,我是否应该能够使用 MSBUILD 构建解决方案? 还是我需要使用CSC?

I usually use web applications in Visual Studio and the MSBUILD taks in Nant builds them without any problems:

<msbuild project="MySolution.sln">
  arg value="/property:Configuration=release" />
</msbuild> 

I now have a website (not a web application) in a VS Solution and it won't build - I get a lot of namespace errors.

Should I be able to build the solution with MSBUILD even though it contains a website? Or do I need to use CSC?

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

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

发布评论

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

评论(3

一袭白衣梦中忆 2024-08-02 21:52:55

如果 msbuild.exe 失败,您应该尝试使用 devenv.exe 命令。 您可能还对感兴趣Web 部署项目

Sayed Ibrahim Hashimi

我的书:Microsoft 构建引擎内部:使用 MSBuild 和 Team Foundation Build

You should try using the devenv.exe command if msbuild.exe is failing for you. Also you may be interested in Web Deployment Projects.

Sayed Ibrahim Hashimi

My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build

月寒剑心 2024-08-02 21:52:55

在 MSBuild 参数中,使用 OutDir 选项来设置输出目录。 然后您将获得以下信息:

  1. 项目中的所有 DLL。
  2. 名为 _PublishedWebsite 的目录。 这会为您提供与 Visual Studio 中的“发布”命令相同的输出。

这就是我们通过 MSBuild 构建 Web 应用程序所做的事情。

In your MSBuild arguments use the OutDir option to set an output directory. You then get the following:

  1. All the DLLs in your project.
  2. A directory called _PublishedWebsite. This gives you the same output a Publish command in Visual Studio.

This is what we do to build our web apps through MSBuild.

給妳壹絲溫柔 2024-08-02 21:52:55
devenv.exe /rebuild debug mywebsite.sln

我发现我必须使用调试而不是发布,否则构建会被跳过。

devenv.exe /rebuild debug mywebsite.sln

I found I had to use debug rather than release or the build was skipped.

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