<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Codepolice.net &#187; Publish fails</title>
	<atom:link href="http://codepolice.net/tag/publish-fails/feed/" rel="self" type="application/rss+xml" />
	<link>http://codepolice.net</link>
	<description>C#, ASP.NET, MVC, LINQ, Wordpress and stuff like that</description>
	<lastBuildDate>Wed, 01 Sep 2010 08:05:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Publish web application project failed</title>
		<link>http://codepolice.net/2009/01/14/publish-web-application-project-failed/</link>
		<comments>http://codepolice.net/2009/01/14/publish-web-application-project-failed/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 17:58:19 +0000</pubDate>
		<dc:creator>Ola</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[MSBuild]]></category>
		<category><![CDATA[Publish failed]]></category>
		<category><![CDATA[Publish fails]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[visual studio 2008]]></category>

		<guid isPermaLink="false">http://www.codepolice.net/?p=133</guid>
		<description><![CDATA[I have had huge problems on various projects with the &#8220;publish&#8221; functionality in Visual Studio 2008. I like the feature, you just click publish, choose a directory and the files that is needed on the webserver is placed in the folder and you can easliy copy it to your server or whatever. The problem with [...]]]></description>
			<content:encoded><![CDATA[<p>I have had huge problems on various projects with the &#8220;publish&#8221; functionality in Visual Studio 2008. I like the feature, you just click publish, choose a directory and the files that is needed on the webserver is placed in the folder and you can easliy copy it to your server or whatever.</p>
<p>The problem with it is that it seems to fail from time to time. The output window gives no clues what so ever what has gone wrong so it&#8217;s kind of hard to debug. When you google it you get all sorts of threads and post about people having problems with this but it seems like it a diffrent solution for it everywhere.</p>
<p>Anyway i gave up and started looking towards MSBUILD and found <a href="http://codingcockerel.co.uk/2008/05/18/how-to-publish-a-web-site-with-msbuild/">this great post</a> about how to simulate the behavior of the publish feature with MSBUILD. You just create a Build.xml file and then you run msbuild.exe build.xml. My Build.xml file looks like this.</p>
<div class="codecolorer-container xml twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Project</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;</span> <span style="color: #000066;">DefaultTargets</span>=<span style="color: #ff0000;">&quot;Run&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Import</span> <span style="color: #000066;">Project</span>=<span style="color: #ff0000;">&quot;C:\Program Files\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PropertyGroup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OutputFolder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Publish<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/OutputFolder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ProjectDir<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:\code\<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ProjectDir<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CompilationDebug</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CustomErrorsMode</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ContentEditorsEmail</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;AdministratorsEmail</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/PropertyGroup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PropertyGroup</span> <span style="color: #000066;">Condition</span>=<span style="color: #ff0000;">&quot;$(Environment) == 'Test'&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;DeploymentFolder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:\Staging\Test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/DeploymentFolder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/PropertyGroup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PropertyGroup</span> <span style="color: #000066;">Condition</span>=<span style="color: #ff0000;">&quot;$(Environment) == 'Live'&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;DeploymentFolder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:\Staging\Live<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/DeploymentFolder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/PropertyGroup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Target</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;Run&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CallTarget</span> <span style="color: #000066;">Targets</span>=<span style="color: #ff0000;">&quot;Compile&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;CallTarget</span> <span style="color: #000066;">Targets</span>=<span style="color: #ff0000;">&quot;Publish&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Target</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;Clean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ItemGroup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;BinFiles</span> <span style="color: #000066;">Include</span>=<span style="color: #ff0000;">&quot;bin\*.*&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ItemGroup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Delete</span> <span style="color: #000066;">Files</span>=<span style="color: #ff0000;">&quot;@(BinFiles)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Target</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;Compile&quot;</span> <span style="color: #000066;">DependsOnTargets</span>=<span style="color: #ff0000;">&quot;Clean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MSBuild</span> <span style="color: #000066;">Projects</span>=<span style="color: #ff0000;">&quot;myproject.csproj&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Target</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;Publish&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;RemoveDir</span> <span style="color: #000066;">Directories</span>=<span style="color: #ff0000;">&quot;$(OutputFolder)&quot;</span> <span style="color: #000066;">ContinueOnError</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MSBuild</span> <span style="color: #000066;">Projects</span>=<span style="color: #ff0000;">&quot;myproject.csproj&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">Targets</span>=<span style="color: #ff0000;">&quot;ResolveReferences;_CopyWebApplication&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">Properties</span>=<span style="color: #ff0000;">&quot;WebProjectOutputDir=$(OutputFolder);OutDir=$(WebProjectOutputDir)\&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>This works great for me for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://codepolice.net/2009/01/14/publish-web-application-project-failed/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->