Plugin to set records' names automatically

On each projects there are entities we can't force user to set names for (because it is needless). However it is good approach if all you records has names, especially if you have to choose these records in lookups.

I use plugins to set names of such entities. To simplify development of such plugins I did a base class and want to share it with you.

Let me show you example of the plugin which is based on SetNamePluginBase (base plugin) I share below.

using ExitoConsulting.Plugins.Base;
using Microsoft.Xrm.Sdk;

namespace ExitoConsulting.Plugins
    public class OwnerSetName : SetNamePluginBase
        protected override string GetName(Entity entity, IPluginExecutionContext context, IOrganizationService service)
            var fullName = entity.GetAttributeValue("ec_fullname");
            var clientId = entity.GetAttributeValue("ec_clientid");

                return null;

            var name = fullName;
                name = name + string.Format(" - {0}", clientId);

            return name;

CRM 2011. Solution import fails with error "An item with the same key has already been added."

Today I was helping to resolve following error during solution import: "An item with the same key has already been added".

I took traces and found following:

EntityService.Update caught exception: System.ArgumentException: An item with the same key has already been added.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.Crm.Metadata.OptionSetService.GetExistingAttributePicklistInternal(Guid optionSetId, OptionSetType optionSetType, Nullable`1 optionValue, ISqlExecutionContext context)

Method "GetExistingAttributePicklistInternal" is retrieving picklist values from CRM and adding these values to a dictionary. It means that you have a problem with CRM instance you are deploying solution into.

I didn't have a chance to find a way how to fix this issue. We decided to use another environment for now and successfully deployed our solution.

Introducing Visual Studio Add-On "Microsoft Dynamics CRM Web Resources Updater"

This add-on will be useful for each Microsoft Dynamics CRM Developer. It allows to initiate upload and publish process directly from Visul Studio. The main benefit is that web resources upload and publish process takes as little time as possible because add-on is only take care about web resources that are changed. It will help to speed up development and debugging processes by allowing you to focus on the code you are crating.

See full description here:

If you have any issue or comment just write me in comments or you can also leave a feedback on Codeplex or Visual Stuio Gallery and I will fix it shortly.

Hope you will love this add-on.