Stop web.config on publish

EDIT: Urgh. What an idiot. As JammyKam rightly points out – I could just set the Build Action to None 🙂 _goes back to bed_

Here’s a short one (and something that bothers me regularly).

I’ve got some modules I’m working on, I have the same codebase working against multiple Sitecore versions for testing but if I forget to update the web.config it kills Sitecore when I publish. Boo!

I was just looking at some previous blogs trying to work out what to blog about next (the SIM project is proving more complex that I’d hoped but the next part of that will be along at some point).

So I reread this blog post https://jammykam.wordpress.com/2016/01/20/excluding-sitecore-assemblies-from-deployment/

“Wait!” I thought, “Can we just tell VS not to publish the web.config?

It seems that we can:

<PropertyGroup>
 ...
 <ExcludeFilesFromDeployment>web.config</ExcludeFilesFromDeployment>
</PropertyGroup>

I’ve *no* idea if this this is wise or not, but it seems to work. I’ll apply it to a few of our modular projects and see how we go!

(Please tell me if this is a stupid idea)

Advertisements

2 thoughts on “Stop web.config on publish

  1. Seems perfectly fine assuming each codebase does not require an updated web.config

    But instead of using Publish Settings, you could also just set the “Build Action” of your config file to “None” (from the Properties option of the file). The default is “Content”, which means the file will be published/output on build.

    Like

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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