<p>When I build my <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a> web application I get a .dll file with the code for the website in it (which is great) but the website also needs all the .aspx files and friends, and these need to be placed in the correct directory structure. How can I get this all in one directory as the result of each build? Trying to pick the right files out of the source directory is a pain.</p>

<p>The end result should be xcopy deployable.</p>

<p><strong>Update:</strong> I don't want to have to manually use the Publish command which I'm aware of. I want the full set of files required by the application to be the build output - this means I also get the full set of files in one place from running <a href="http://en.wikipedia.org/wiki/MSBuild" rel="nofollow noreferrer">MSBuild</a>.</p>

[{'answer_id': 55326, 'author': 'GEOCHET', 'author_id': 5640, 'author_profile': 'https://Stackoverflow.com/users/5640', 'pm_score': 0, 'selected': False, 'text': "<p>Have you tried right clicking the website in Solution Explorer and clicking 'Publish Website'?</p>\n"}, {'answer_id': 55328, 'author': 'Joel Coehoorn', 'author_id': 3043, 'author_profile': 'https://Stackoverflow.com/users/3043', 'pm_score': 2, 'selected': False, 'text': "<p>ASP.NET doesn't have <em>real</em> xcopy deployment for <em>new</em> sites.  It depends on having a virtual directory/Application in IIS.  However, once that virtual directory is created you can use xcopy for updates.</p>\n"}, {'answer_id': 55333, 'author': 'Gulzar Nazim', 'author_id': 4337, 'author_profile': 'https://Stackoverflow.com/users/4337', 'pm_score': 1, 'selected': False, 'text': '<p>You can <a href="http://msdn.microsoft.com/en-us/library/1y1404zt(VS.80).aspx" rel="nofollow noreferrer">Publish Web site</a>..If you want to automate your deployment, you need to use some <a href="http://www.codeproject.com/KB/install/DeploySite.aspx" rel="nofollow noreferrer">script</a>. </p>\n'}, {'answer_id': 55335, 'author': 'NakedBrunch', 'author_id': 3742, 'author_profile': 'https://Stackoverflow.com/users/3742', 'pm_score': 0, 'selected': False, 'text': '<p>Build --> Publish </p>\n\n<p>A dialog box will appear that will guide you through the process.</p>\n'}, {'answer_id': 55347, 'author': 'GEOCHET', 'author_id': 5640, 'author_profile': 'https://Stackoverflow.com/users/5640', 'pm_score': 0, 'selected': False, 'text': '<p>For the automated building you describe in the update, I would recommend you look into <a href="http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx" rel="nofollow noreferrer">MSBuild</a> and <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET" rel="nofollow noreferrer">CruiseControl.NET</a></p>\n'}, {'answer_id': 56645, 'author': 'Simon Steele', 'author_id': 4591, 'author_profile': 'https://Stackoverflow.com/users/4591', 'pm_score': 4, 'selected': True, 'text': '<p>One solution appears to be Web Deployment Projects (WDPs), an add-on for Visual Studio (and msbuild) available that builds a web project to a directory and can optionally merge assemblies and alter the web.config file. The output of building a WDP is all the files necessary to deploy the site in one directory.</p>\n\n<p>More information about Web Deployment Projects:</p>\n\n<ol>\n<li><a href="http://blogs.msdn.com/webdevtools/archive/2008/01/25/announcing-rtw-of-visual-studio-2008-web-deployment-projects-wdp.aspx" rel="nofollow noreferrer">Announcement on webdevtools MSDN blog</a> for WDP 2008</li>\n<li><a href="http://weblogs.asp.net/scottgu/archive/2005/11/06/429723.aspx" rel="nofollow noreferrer">ScottGu introduction to WDP 2005</a></li>\n</ol>\n\n<p>The only disadvantage to this solution is the requirement on an add-on which must be available on the build machine. Still, it\'s good enough for now!</p>\n'}, {'answer_id': 78555, 'author': 'Min', 'author_id': 14461, 'author_profile': 'https://Stackoverflow.com/users/14461', 'pm_score': 1, 'selected': False, 'text': '<p>Have you tried using the aspnet_compiler.exe in your .net framework directory? I\'m pretty sure you can create a "deploy ready" version of a web application or web site.  </p>\n'}, {'answer_id': 1296333, 'author': 'JCallico', 'author_id': 143195, 'author_profile': 'https://Stackoverflow.com/users/143195', 'pm_score': 1, 'selected': False, 'text': '<p>The _CopyWebApplication target on MSBuild will do exactly what you need. The catch is that only the main assembly will be copied to the bin folder and that\'s why a copy task is needed to also copy any other file on the bin folder.</p>\n\n<p>I was trying to post the sample script as part of this post but wasn\'t able to.</p>\n\n<p>Please take a look at this <a href="http://callicode.com/Homeltpagegt/tabid/38/EntryId/27/How-to-only-publish-the-runtime-files-of-an-asp-net-application-using-CruiseControl-net.aspx" rel="nofollow noreferrer">article</a> on my blog that describes how to create a MSBuild script similar to the one you need.</p>\n'}, {'answer_id': 18270616, 'author': 'Jonathan', 'author_id': 964102, 'author_profile': 'https://Stackoverflow.com/users/964102', 'pm_score': 0, 'selected': False, 'text': '<p>It depends on how complicated solution you need, you could just use a script and jenkins for example. You can use MSBUild with Jenkins for just deploying to an IIS. And if you got Jenkins other tools is pretty easy to connect into it later on. But if you just want to build, use a script that jenins execute every build that uses MSDeploy and it will work great.</p>\n\n<p>This is how i do it, just to give you a feeling:</p>\n\n<p>Sonarqube uses Gallio, Gendarme, FXcop, Stylecop, NDepths and PartCover to get your metrics and all this is pretty straight forward since SonarQube do this automatically without much configuration.</p>\n\n<p>Here is Jenkins witch builds and get Sonar metrics and a another job for deploying automatically to IIS. I use a simple script one line that calls my MSBuild and wich URL, pass and user.</p>\n\n<p><img src="https://i.stack.imgur.com/VbAmP.png" alt=""></p>\n\n<p>And Sonarqube, all metrics for my project. This is a simple MVC4 app, but it works great!:</p>\n\n<p><img src="https://i.stack.imgur.com/0nKLI.png" alt=""></p>\n\n<p>If you want more information can i provide you with a good guide.</p>\n\n<p>This whole setup uses MSBuild, too build and deploy the apps.</p>\n'}]
['https://Stackoverflow.com/questions/55323', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4591/']