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.
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.