构建 .NET 项目时合并外部文件
我有一个复杂的网站,有 .NET 开发人员、ActionScript 开发人员和前端 HTML/JS 开发人员(我是 .NET 开发人员之一)。从技术上讲,该站点是一个 .NET Web 应用程序,但 AS 和 UI 开发人员从未真正启动 Visual Studio 或 MsBuild。
我们当前的发布脚本使用“/t:ResolveReferences;_CopyWebApplication”在 Web 应用程序项目上调用 msbuild.exe,然后将输出复制到远程服务器。由于此方法仅复制 .net web 项目中包含的文件,因此我经常遇到 AS 开发人员或 UI 开发人员的文件未部署的情况,因为他们从未将文件添加到 .NET 项目中。
显而易见的解决方案是告诉其他开发人员他们必须将文件添加到 .net 项目中,但这似乎很粗暴且容易出错。
是否有一种好方法可以在预构建或构建过程中将排除的文件添加到 .net 项目中? 通常,发往 Web 服务器的所有文件都已位于 /web 目录下,该目录还包含 .net 文件。 net 网络项目。现在我只想能够自动(通过 msbuild 或其他脚本)包含该目录中的其余文件。
I have a complicated website with .NET developers, ActionScript developers and front-end HTML/JS developers (I am one of the .NET developers). The site is technically a .NET Web Application but the AS and UI developers never actually fire up Visual Studio or MsBuild.
Our current publishing script calls msbuild.exe on the web application project with "/t:ResolveReferences;_CopyWebApplication" and then copies the output to the remote server. Since this method only copies files that are included in .net web project, I often get in the situation where files from the AS developers or UI developers aren't deployed because they never added the files to the .NET project.
The obvious solution is to tell the other devs that they must add the files in the .net project but that seems heavy-handed and error-prone.
Is there a good way to add excluded files to the .net project during pre-build or build? Typically all of the files destined for the web server are already under a /web directory that also includes the .net web project. Now I just want to be able to automatically (via msbuild or another script) include of the rest of the files in that directory.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
转到项目的属性,然后在“编译”选项卡下单击“构建事件”按钮。然后,您可以使用 XCopy 命令复制其他文件。您可以管理在 XCopy 命令中复制哪些文件或目录,但它足够灵活,您可以指定它复制某个目录中扩展名为 .js、.ascx、.gif 的所有文件, ETC。
Go to the properties of your project and under the Compile tab click the Build Events button. You can then use the XCopy command to copy the additional files. It will be up to you to manage what files or directories get copied in the XCopy command, but it's flexible enough to where you can specify it to copy all files in a certain directory that have an extension of .js, .ascx, .gif, etc.