Configuring publish in Visual Studio 2008

Just a quick one. I was working on an old site today where we have some legacy php code (ie the shop is still in php). As our brief was to create the new website but just to leave the old shop in php hanging off a /shop url, I simply imported that directory into Visual Studio to keep all the files that need publishing in one place. However, by default  Visual Studio 2008 will not publish .php files. When the project is published using the option to publish only the files needed to run this web application it skips the .php files as it doesn’t see them as ‘needed’. It will quite happily publish any jpgs though as it sees those as content and hence required.

But of course that is the solution. To Visual Studio 2008 a .php file is not required for the site to run nor is it seen as a ‘valid’ resource.

To solve this, select the files that aren’t being published, then select the properties tab and mark the Build Action as ‘Content’.

The next time you publish, all of the files that you have marked as content will be published to the output folder or ftp location.

Hope this helps.

(By the way look at what they have done in Visual Studio 2010 and you will see that the publish feature is a lot more flexible).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s