Monday, March 10, 2014

Could Not Load Type System.ServiceModel .net 4 Web App

 

While attempting to load a .Net 4 website I kept getting a configuration error and the following item in the Event Log

Exception information:
    Exception type: ConfigurationErrorsException
    Exception message: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Turns our that IIS didn’t have all the .Net components installed.  To fix this you can run the following command which will update IIS with the correct .Net components.  Didn’t even require a reboot.

c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -iru

Thursday, March 6, 2014

Visual Studio Error: The given assembly name or codebase was invalid (HRESULT: 0x80131047)

When attempting to add a reference to a project this error kept appearing. 

image

I though it was because I had switched the project from .Net 3.0 to 3.5 but it turns out it was something else.  The problem turned out to be that the assembly path contained a comma (eg. C:\Libraries\MyLibrary{1-1-14, Customer}).  Once I moved the assembly to C:\Libraries it added correctly.

Wednesday, March 5, 2014

Pass XRM Ribbon Parameters Using JavaScript Array

Trying to pass the list of selected items from a grid using query parameters has limitations due to restrictions on the size of a URL.  Instead use JavaScript to pass Ribbon parameters to a variable on the XRM page and grab the data in the popup window.

Ribbon Command Setup
Here we pass the SelectedControlSelectedItemIds which will pass an object array of all the record ids that are selected on the home grid.

image

Ribbon JavaScript Web Resource
The web resource will data the ids and post them to a new variable in the main XRM window then opens a popup window.

image

AddApplicantsToCourse.htm
This popup page will get the ids from the page that opened it.  In order to do so we need to do the following:

-Include jQuery
-declare the array to hold the id values
-copy the values from the object in the parent page to the array you created

image