Installation and deployment
Version 7.x > Installation and deployment > How to create new site programmatically on existing Kentico instance View modes: 
User avatar
Member
Member
vovayarymovych-gmail - 12/20/2013 3:40:00 AM
   
How to create new site programmatically on existing Kentico instance
I need to implement site installer with predefined site template on existing instance of Kentico.

I've found out that Kentico provides 'Silent Install' feature, so I can configure xml file and execute SilentInstall.exe MyNewSite.xml.

As I understood from the documentation, I am able to configure that xml to install new site based on available web template. But after a couple of attempts, I couldn't do it. I've got a message that I should uninstall previous installation of Kentico.

So maybe I'm doing something wrong. Could you please give me some instructions or sample xml file to install the site on existing instance if it's possible?

If not, are there any other approaches to programmatically imitate 'New site wizard'?

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 12/20/2013 3:45:04 AM
   
RE:How to create new site programmatically on existing Kentico instance
Hi,

Thank you for your message.

The best way you can accomplish such thing is to use our API to create a site.

You can find some basic examples of site API at http://devnet.kentico.com/docs/devguide/sites_api_examples_managing_sites.htm

Once you have your site created you are free to create any other pages, documents, templates etc.. All this with the help of our API in the given section.

Kind regards,
Richard Sustek

User avatar
Member
Member
vovayarymovych-gmail - 12/20/2013 4:47:37 AM
   
RE:How to create new site programmatically on existing Kentico instance
Hi, thanks for your response.

I am not sure it meets my expectation.

Due to requirements I should have site installation logic on WCF service (can be inside one of Kentico web sites) and installation process should be performed on other different Kentico instances. Also I should have a folder with all possible site templates on service side. Is it possible to do it the way you advised? As I see, those APIs must be executed in context of instance I want to install the site on.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 12/20/2013 6:28:35 AM
   
RE:How to create new site programmatically on existing Kentico instance
Hi,

Thank you for your message.

Once you connect to some db using connection string and include needed binaries it could be possible, but you seem to want something like our wizard installer when you are installing Kentico. Im afraid that I wont be able to help you with such request as this is really complicated issue and not easy task at all. I can only recommend, if you really need such thing, to schedule a meeting with our consultants which can give you more precise information about this.

Thank you for understanding.

Kind regards,
Richard Sustek

User avatar
Member
Member
vovayarymovych-gmail - 12/20/2013 11:19:10 AM
   
RE:How to create new site programmatically on existing Kentico instance
Ok, thanks for your help.

Then lets get back to the APIs you mentioned earlier for creating new site. Is there a possibility to set name of web template when creating SiteInfo object?
I just can't find a property named like 'WebTemplate'

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 12/20/2013 11:34:45 AM
   
RE:How to create new site programmatically on existing Kentico instance
Have you downloaded and checked out all the API documentation for Kentico? This will have all the methods, functions, properites of classes, etc. that you'll need in order to complete your custom coding. There may or may not be examples but you should be able to find the properties you need.