Source control for Kentico

Nicky Nguyen asked on November 6, 2014 04:23

Hi all,

My project just started, we plan to use TFS as source control but there is a thing I am concerned now, that is how we can deploy the change with master page, layout ... to the staging server. They are laying in database so we could not do that.

And Is that possible to check a web part then there is a build deploying automatically change of code to the staging server

I'm new with kentico, sorry if my question is stupid.

Thanks, Nicky

Correct Answer

Brenden Kehren answered on November 7, 2014 01:04

I put my whole site in source control I don't store any objects in the file system that is what the CMS is for. Take more backups of your database if you're concerned with losing it. Kentico has built in tools for developers and they work very well.

You might think twice on the development mode your using as well. I highly recommend following Kentico's recommendations and using Portal mode. Your client will gain the most control with that method. And you as the developer will learn how to properly take advantage of all the features (content, development, etc.) that Kentico has to offer. A small amount of time learning up front will make your experience with Kentico 100% better.

Unfortunately far too many developers (IMHO) just jump into "creating pages" and writing code using aspx mode and never learn the other development modes and end up making their life much more difficult than it should be.

5 votesVote for this answer Unmark Correct answer

Recent Answers

Ladislav Margai answered on November 6, 2014 09:03

Hi Nicky,

Kentico provides a way to store virtual objects in the file system in addition to the database. This can be useful if you need to prepare your site for deployment, or if you want to manage the code of objects using a source control system. Virtual objects that require compilation include the following:

  • Form layouts (ASCX type)
  • Page layouts (ASCX type)
  • Transformations (ASCX type)
  • Web part layouts

You can find more information in the documentation:

Best regards,

0 votesVote for this answer Mark as a Correct answer

MyPoint CreditUnion answered on November 6, 2014 17:19

If I put everything into deployment mode would I be able to control the whole site in Git?

I have it Git set up to watch my "CMS" folder, but from what I understand I can not put my database under Git version control.

If I store all objects in the file system does that mean content too? I only understand it to mean the Kentico files, not content. Has anyone put their whole site under Git? I would really like to do that.

0 votesVote for this answer Mark as a Correct answer

Charles Matvchuk answered on November 7, 2014 03:30

I have to concur with Brenden. We have a very large and complex site. That is highly customized. We are also very good at developing enterprise level applications using all the latest techniques. When we began working with Kentico we were rolling our own .aspx pages and integrating them into Kentico. This worked OK, but in the end we found that it was much better to use the portal engine and then create web parts (.acsx) controls and custom modules. When we made the switch to 8.1, we completely removed all of our aspx pages and created custom web parts. This way we leverage every feature that Kentico has and augment it with what we need. Our web parts (.acsx controls) are modular and portable and very easily maintained. We just import and export them to the production website once they have finished testing. There is no reason to build standard .aspx pages and to be quite frank you can develop yourself into a corner. I speak from experience. We keep our acsx controls and custom .cs (.dll's) in source control only, we use TFS (Visual Studio Online). I am not concerned with the rest of the projects files, since I can fresh install if something goes bad and just bring down our customizations.

We look at Kentico as our foundation and scaffolding and plug in our customizations. We have not found anything that we cannot accomplish with this method.

3 votesVote for this answer Mark as a Correct answer

Charles Matvchuk answered on November 7, 2014 04:12

One more thing to add, and most don't know this, we didn't realize is for some time till we saw it in a post here. You can write inline C# in the page markup in the portal engine, the same as you can in Visual Studio instead of putting the code in page-behind. You of course have to have the correct

1 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 8, 2014 01:27

There will be some instances where you will need to add .cs files to your App_Code directory or even add web services, so don't think you can't do that. As Charles mentioned you can add inline C# in your transformations and portal engine templates and layouts but don't over complicate it there, create a custom namespace and set of functions and methods to handle the work so all you need to do is add a single line of code in your page. This still allows you to keep your business rules and such in source control.

If you have any question about any of this please look me up, I'll take some time and share with you what I've learned by education and experience with Kentico.

1 votesVote for this answer Mark as a Correct answer

Nicky Nguyen answered on November 8, 2014 12:28

Thanks Bren, I'm now starting a project with Kentico. Could you give me your contact if you don't mind? I am new with Kentico and may have some questions that you have answers already.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 9, 2014 06:33

@Nicky, google me, you'll find my info ;)

Otherwise head to Kehren Development

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.