Our Forum has Moved

This site is our old forum and is only here for achive until we get proper 301 redirects setup to make Google happy.

Please use our new community site - Our Umbraco - which contains an improved forum, documentation wiki, package repository and a member locator.

Go to Our Umbraco now

Learn everything about Umbraco
upgrade a package Options
sgiannone
Posted: Wednesday, June 17, 2009 5:16:59 PM
Rank: Newbie

Joined: 6/17/2009
Posts: 3
Hi guys,

I'd like to create a new version of a package, and then install it into an umbraco with the older version already installed.

This is fine. But, when I try to install the new version on the target umbraco, the system raises the following asp.net exception:


Item has already been added. Key in dictionary: "MyTemplate-name" Key being added: "MyTemplate-name"]


If I manually remove that template installation goes OK.

But if I delete the template, contents based on that template will lose the link with the template......

What is the correct process for the creation of a upgrade package?

Thanks

Stefano
iwache
Posted: Thursday, June 18, 2009 12:24:48 PM

Rank: Enthusiast

Joined: 6/20/2008
Posts: 30
Location: Berlin - Germany
Hi Stefano,

I'm not an expert in the internal database structure of umbraco, but I would assume
that every template has an entry in db with it's own unique key-id. And the document types refer to this id, but not the name of the templates. So when you delete a referenced template and add a new one with same name, it neverless gets its new own key-id. This new one is of course not referenced by your existing doc types.

Simple solution: Update the doc type references to the templates manually in the Umbraco backend.

Difficuilt solution:

Create and add an package action handler which will do basicly follow steps:

- get the current id of the name of the template to replace, e.g. MyTemplate - ID: 1234
- remove this current template,
- rename your new added template to the old name (this is the template you are about to update, (to avoid the error you described you must give the update template inside the package a different name to the existing one, e.g. MyTemplate_Update)
- change the ID of this new added template back to the ID of the old one (1234).

For this solution you must be able to write C# code. For more informations refer to:
Package Actions Contrib.

May be helpful: For this way you can use my little Package Action Tester:
http://www.ucc-bln.de/en/2009/3/28/package-action-tester.aspx

Immo
sgiannone
Posted: Thursday, June 18, 2009 12:38:05 PM
Rank: Newbie

Joined: 6/17/2009
Posts: 3
I suppose this is a common issue during the development/deployment process of a web site based on Umbraco.

I mean... how do you manage the production deployment process of changes to an existing site created in a local development environment?

This is my real goal.

I'd like to be able to develop and test changes into my local environment and then upload and install changes into the production machine.

Thank you so much for your help.

I appreciate it.

Bye
Stefano
rsoeteman
Posted: Thursday, June 18, 2009 12:49:27 PM

Rank: Fanatic

Joined: 4/3/2008
Posts: 269
Location: The Netherlands
Hi Stefano,

I agree with you that you shouldn' have these errors. when you load an updated package. But for deployment it's maybe better to just ftp your modified Master pages/xslt and Usercontrols.

Cheers,

Richard

level 2 certified - Umbraco development - Soeteman Software

Import data into Umbraco? Consider using UmbImport
sgiannone
Posted: Thursday, June 18, 2009 12:56:30 PM
Rank: Newbie

Joined: 6/17/2009
Posts: 3
Thanks Richard.

Is this the process you use too?

So you're suggesting me to remove templates from the packages, upgrading it manually through ftp... right? (anyway this approach is not good for new templates...)

The problem is the also css and document types (not sure) are duplicated when I install the package and items already exist into the target server.

Is there a way to update existing umbraco items using a package (or other deployment methods)?!?

I do not want to create a new item if it already exists into the target server. I'd like to upgrade it with the new version, with object id retention.

Bye,
Stefano
rsoeteman
Posted: Thursday, June 18, 2009 3:53:27 PM

Rank: Fanatic

Joined: 4/3/2008
Posts: 269
Location: The Netherlands
Hi Stefano,

Yes this is how I do it. And then create a package for the new items. Agree it's not ideal but I don't do much updates after a site is deployed. Don't know if the problems your are facing now are reported on Codeplex Maybe that is good to do also. Because you cannot automatically update items using a package.

Now that I'm thinking of it, maybe this will help you (just a theory never tested it)

- create a package with the template
- Do some updates in your template
- Create an update package, ONLY INCLUDE the masterpage in that package (under package files), Do NOT select the template (under package Contents).

In theory this should work because you only overwrite the template file.

Please let me know if this worked (or not).

Cheers,

Richard

level 2 certified - Umbraco development - Soeteman Software

Import data into Umbraco? Consider using UmbImport

The forum has moved

This forum is no longer in use, so you can't reply to this message - please go to Our Umbraco

Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.