Archive
Missing ‘Connect to Dynamics CRM Server’ from visual studio solution
I recently created a new Visual studio solution using Dynamics CRM 2013 Template.
So I get “Connect to Dynamics CRM Server” window whenever I open the solution, which allows me to connect my CRM Organization.
Later I added a new “Class Library” project to my solution.
Now surprisingly when I open the solution, I am not getting “Connect to Dynamics CRM Server” window also from ‘Tools’ Menu.
Reason –
- I opened my solution file (.sln) using notepad and observed below ‘Global Section’ is missing and overridden by newly added Project details.
GlobalSection(CRMSolutionProperties) = preSolution
SolutionIsBoundToCRM = True
EndGlobalSection
Fix –
- Add the ‘Global Section’ back to solution file using Notepad and Save it.
🙂
Adding components to solution programmatically in CRM 2011
Hi,
We can add components to the solution programmatically by passing
- Component meta data id
- component type
- Solution unique name
to “AddSolutionComponentRequest“.
Lets say, I have a solution named “Rajeev” in my organization.
Below is the code to add a component (i.e.,. Account entity) using IOrganization service
this.credentials = new ClientCredentials();
this.credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
this.organizationUri = new Uri(“http://servername/orgname/XRMServices/2011/Organization.svc”);
using (
this.serviceProxy =
new OrganizationServiceProxy(this.organizationUri, this.homeRealmUri, this.credentials, null))
{
this.serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
this.service = this.serviceProxy;
}
// Get component (i.e., Account) metadata
RetrieveEntityRequest retrieveForAddAccountRequest = new RetrieveEntityRequest()
{
LogicalName = Account.EntityLogicalName
};
RetrieveEntityResponse retrieveForAddAccountResponse = (RetrieveEntityResponse)this.service.Execute(retrieveForAddAccountRequest);
// Pass ‘Component Type’ (i.e., 1 for Entity)
// Account metadata Id
// Solution unique name
// To “AddSolutionComponentRequest”
AddSolutionComponentRequest addReq = new AddSolutionComponentRequest()
{
ComponentType = 1,
ComponentId = (Guid)retrieveForAddAccountResponse.EntityMetadata.MetadataId,
SolutionUniqueName = “Rajeev”
};
this.service.Execute(addReq);
🙂
Solution import error in CRM 2011
Hi,
Sometimes you may get above error screen, when you try to import the “Solution”.
Reason:-
- Let’s assume you have a solution “XYZ.zip” with 3 files (i.e., [Content_Types].xml, Customizations.xml & Solution.xml)
- Extract the “XYZ.zip” to “XYZ_new” folder
- Do some customization changes (i.e., Add few buttons to Ribbon) to “Customizations.xml”
- Save the changes
- Zip the “XYZ_new” folder to “XYZ_new.zip”
- Try to Import the “XYZ_new.zip” as solution and you would get “Import solution error”
Fix:-
- Always zip the files from root level not from folder level
- i.e., When you make changes to solution files (Refer step 3 & 4) don’t zip “XYZ_new” folder, instead follow this step
- open “XYZ_new” folder and select files (Ctrl + A) and zip the files to “XYZ_new.zip”
- Import the zip
- Get the “Imported successfully” message
Hope it helps 🙂