Tuesday, April 29, 2014

Could not load file or assembly '$SharePoint.Project.AssemblyFullName$' or one of its dependencies - WCF services in SharePoint

Requirement: Create a WCF service inside SharePoint Layouts folder so that it can be used with in SharePoint objects such as WebParts comfortably.

Note: WCF Services development for SharePoint is not covered here.

Issue: After deploying the service to Layouts using Visual Studio IDE, it throws an error while browsing the service.

Error details:
"System.IO.FileNotFoundException: Could not load file or assembly '$SharePoint.Project.AssemblyFullName$' or one of its dependencies. The system cannot find the file specified.    at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)     at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)     at..........
 "

Solution:
By default in SharePoint 2010, the .SVC templates package is not configured, We need to configure this with a change the target file.

Steps are provided below:
1. Check for the target file (Microsoft.VisualStudio.SharePoint.targets) in the following localtion:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\SharePointTools
2. Open the file in a Notepad or Textpad and search for  ;ascx and and in the same line add ;svc as given below:
$(TokenReplacementFileExtensions);xml;aspx;ascx;webpart;dwp;svc
3. Save the changes and close it.
Deploy the project that has WCF service (SVC) files from Visual Studio. This should resolve the issue.
Note: This change is required in each developer machines that deploy the solution using Visual Studio. This change is not required for Non Development Environments like Test or Production (where visual studio deployments are not possible) since the WSP that is generated from a Developer machine contains the required SVC file in correct format



Enable PowerShell ISE in Windows 2008 R2 server

Requirement: Enable PowerShell ISE in windows 2008 R2 server for script

Solution Steps:
1. Open SharePoint POwerShell and run the below commands
  a)    Import-Module ServerManager
 b) Add-WindowsFeature PowerShell-ISE 


Access to XMLHttpRequest at 'from origin has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. .net core angular

Issue: The angular application was getting error from API that the origin has been blocked by CORS policy. Solution: Make sure that the...