Could not load file or assembly 'Microsoft.Xrm.Client - dynamics-crm-2011

I have created a plug-in in CRM. It’s registered successfully. Inside my plug-in I have created a web service with many functions.
After successful calling of plug-in step I am getting error-
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Xrm.Client, Version=5.0.9689.2166, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies`. The system cannot find the file specified.
To solve this issue I have created the New XRM.cs file from crmsvcutil.exe but got the same issue. Searched more about this but no solutions found yet.
NOTE: I am using the Microsoft hosted version of CRM
Here below the reference files which I am using.
microsoft.crm.sdk.proxy
Microsoft.CSharp
microsoft.xrm.client
microsoft.xrm.portal
microsoft.xrm.sdk
System
System System.Core
System.Data
System.Data.Services
System.Data.Services.Client
System.DirectoryServices.AccountManagement
System.Runtime.Serialization
System.ServiceModel
System.Xml
System.Xml.Linq
Is there any way to run my plugin on Hosted version of CRM???
Appreciate if any help :)

I have solved this issue by using this command.
CrmSvcUtil.exe /out:"Xrm.cs"
/url:http://crm/Contoso/XRMServices/2011/Organization.svc
/namespace:Xrm
/servicecontextname:XrmServiceContext
/servicecontextprefix:Xrm
removing code customization options solved my issue.
/codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration"

Microsoft.XRM.Client is usually not needed by the plug-in.
It is needed to connect to CRM from an outside application.
Microsoft.XRM.Client has been removed from the SDK since CRM 2016.
Plugins do not automatically resolve dependencies in your project, they have to already be on the server.
Microsoft.XRM.Client can be placed in the GAC if it is needed by the plugin.
Update for Dynamics CRM 2015
The NuGet package Microsoft.CrmSdk.Extensions contains Microsoft.Xrm.Client.
Update for Dynamics CRM 2016 and Dynamics 365
Microsoft.Xrm.Client is no longer part of the SDK.
The NuGet package Microsoft.CrmSdk.CoreAssemblies contains everything needed for plugin development.
The various parts of the Dynamics CRM SDK are in NuGet.
NuGet is a much better solution than adding Dynamics CRM dlls as project references; especially for source control and team development.

Microsoft.Xrm.Client.dll doesn't actually appear to work if running from the GAC. This is because of some dodgy type resolution methods it has that only work if the assembly is loaded locally. I have raised an issue with full details about that here: https://community.dynamics.com/crm/f/117/t/144464.aspx

Related

References and .dll missing from TFS get latest

I'm having an issue related to team foundation server with Visual Studio 2012.
I've checked in a new solution to the server, however when i get latest version for other machines, most of the references are missing and the .dll files in the bin cannot be located.
Is this because the files are not being pushed when i check in.
Any help is appreciated thanks
In Solution Explorer, right click the DLLs that aren't being included, go to Properties, and be sure that the Build Action is set to "Content".
Check whether you are using MSBuild-Integrated solutions or using Automatic Package Restore. If you use MSBuild-Integrated solutions, migrating MSBuild-Integrated solutions to use Automatic Package Restore.
If you haven't used Nuget to restore package. Check: https://docs.nuget.org/consume/package-restore
Check whether your project link to other projects. Don't reference output assemblies. Make a project reference or create a NuGet package.

Entity Framework 6 with Sharepoint 2013

I tried without success to get a SharePoint 2013 application page or web part to work with Entity Framework 6 (6.0.1 to be exact - the version installed into Visual Studio 2012 by default using NuGet at time of writing).
My code was very simple for test purposes, just reading data from one table.
I could install the package just fine, create models, see that the they were properly configured etc, no problem - but whenever I tried to load the page I got the error:
Event code: 3008
Exception type: ConfigurationErrorsException
Exception message: An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework' or one of its dependencies. The system cannot find the file specified. (C:\inetpub\wwwroot\wss\VirtualDirectories\[sitename]\web.config line 36)
I copied all of the config settings from the App.Config file in VS (created by the EF install), into the web.config, verbatim.
I tried every suggested fix I could find on the interweb (e.g. changing the EF assembly ref to "Specific version = false", changing version refs in the config file to the specific version... all sorts) but nothing worked.
I created a console app using the same settings and it worked fine, so I know it's not a server-specific issue - looks like a compatibility issue with SP2013, anyone have any ideas?
I installed EF 5 using the NuGet console, and finally got it working with that... but I'm very curious as to why EF 6 refused to play ball.
Thanks
Poolio
You need to deploy the Entity Framework assemblies (EntityFramework.dll, EntityFramework.SqlServer.dll) as part of your SharePoint solution package. You can reference external dlls in the package.

Issue with ReportViewer on Windows Azure websites (WAWS)

In one of my project i have used reportviewer control to display reports on web pages and at time of uploading on Azure I have followed the steps mentioned here
After uploading when i runs that report web page then it's giving me below error
An error occurred during local report processing.
The definition of the report 'Reports\Report1.rdlc' is invalid.
An unexpected error occurred in Report Processing.
Could not load file or assembly 'Microsoft.ReportViewer.ProcessingObjectModel, >
Version=10.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
dependencies. The system cannot find the file specified.
What should be cause of this?
Update:
I have added following 2 dlls as shown in below snap
Microsoft.ReportViewer.Common.dll (10.0)
Microsoft.ReportViewer.WebForms.dll (10.0)
After long research i found solution of my problem from this link
The problem with missing reference of below dlls
Microsoft.ReportViewer.ProcessingObjectModel.dll
Microsoft.RevportViewer.DataVisualization.dll
but after instaling i could not found those dlls in C:\Windows\Microsoft.NET\assembly\GAC_MSIL
But there is assembly files available in this path C:\Windows\assembly
then i have added those dlls using VS2010 directly as shown in below fig.
And it's worked!
What is the version of ReportViewer you have used in this project and would you please specify how many and which one Reference DLL you have included in your project? This will help to ensure that you have included all the DLL properly in your project. You must use Report Viewer SP1 which is compatible with Azure DB, and the same SP1 language pack.
I would suggest FTP to your website and verify that you do have all the DLL uploaded correctly as you configure in your project. This is the best way to check in Windows Azure Websites if all the configured files made it to file server.

Error While Deploying wsp in SharePoint 2010

I am upgrading an SP2007 project to SP2010 where I have made the necessary changes to the project(changed the reference, master pages, etc.). I have deployed the farm solution in my machine I am getting the following error:
Cannot add the specified assembly to the global assembly cache: System.Web.Extensions.dll.
I have referenced this DLL in my project.
Could anyone help me to resolve this issue?
Another good idea is to include an iisreset and a Restart-Timer SPtimerv4 while deploying, as this will help to release similar locks.
However, do you really need to deploy System.Web.Extensions with your WSP now that you've upgraded to 2010? Since 2010 runs on .Net framework 3.5 it should already be present on your server..
Best regards,
Rikard

Version SharePoint WSP

Has any one tried to version WSP in SharePoint 2010?
Thanks,
It would help to be a bit more specific that ".wsp" in your question.
As Flo mentioned - if you keep the assembly version the same but change the AssemblyFileVersion then you can upgrade the assemblies in your WSP solution using
STSADM -o upgradesolution ...
See my answer on SO - How can I use wildcard assembly versioning?
This will suffice for webparts but if you've got other artifacts and are using things like Feature things like event receivers then you may have to retract and re-deploy.
Thanks all for your replies. I have two concerns:
a. Assume my wsp is deploying a webpart with assembly version as 1.0.0.0 and assembly file version is also 1.0.0.0. Now after few days i need to deploy a recent version of webpart. The assembly version now will be 2.0.0.0 and assembly file version will also be 2.0.0.0. I have noticed that even if i retract and redeploy the wsp, the .webpart files that sits in the web part gallery always shows assembly version as 1.0.0.0. I guess this is because wsp retraction will not delete the .webpart file and neither feature deactivation. So the only option that remains is to write feature deactivation code to delete the .webpart file from webpart gallery. This will be largely in efficient as i will need to iterate through all the site collections of deployed webapplication to determine from the code ( a windows form as installer) the site collection where feature is activated and deactivate the same.
b. I need to query the webpart dll version for some operation. I was thinking it will be good if we can version wsp and keep the wsp version same as the web part dll. This will help me to remain in the SharePoint context to determine the web part dll version ( rather than querying the dll to find the version).
Thanks
WSP don't really version.
You can however version components into it:
Feature or WebParts via different names (FeatureV1, FeatureV2...)
Assembly using standard assembly versioning (WebpartV1 use assembly 1.0.0, WebPartV2 use 1.1.0 and so on)
...

Resources