I received this error after switching from the CRM 2013 SDK dlls to the new CRM 2015 SDK .Dll’s.
The type or namespace name ‘Xrm’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?)
Which led me to this StackOverflow question; “Can’t access Microsoft.Xrm namespace” which seems very similar but does not solve my problem.
What eventually led me to a solution was a warning listed further down in the list of errors. It seems that Microsoft with the new SDK has switched to .Net 4.5.2 so the whole problem for me was that I needed to install a later version of .Net (minimum 4.5.2) and then switch target frameworks to this.
This is the warning that led me to this solution:
The primary reference “Microsoft.Xrm.Client, Version=5.0.9689.2166, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL” could not be resolved because it was built against the “.NETFramework,Version=v4.5.2″ framework. This is a higher version than the currently targeted framework “.NETFramework,Version=v4.5.1″.
So the solution turned out to be as simple as getting the developper pack of .Net 4.5.2. and switching target frameworks on my project to this in visual studio.
I’ve recently been playing with Unity quite a bit and got stuck on how to add event listeners to buttons that I made in the visual designer programatically and not through the ui interface. This Code adds an onClick event to any button in the scene, and if any of them are clicked the method ButtonClick is called with the button as a paramater.
In my opinion, this is much nicer than using the messy graphical interface to set it up, and also keeps all the logic in the main game class.
I’ve been working on a game in Unity for a few weeks and I have been using the WWW object to make POST requests. Problem is that the WWW blocks the rendering thread so long running queries can make the game lag and stutter (alot).
To try to fix this I wanted to make a separate thread for all my network calls but since Unity is not thread safe I could not use the WWW request any more.
So I remade the request using the WebClient class, which was working great up until I tried it on windows phone. It appears this is not supported on WP. The reason for this is that twindows phone uses a slimmed down version of .net where as iOS and Android compile the code using .net mono.
Windows Phone 8 uses a different flavor of .NET called .NET for Windows Phone which is missing some of the types available on other platforms. You’ll have to either replace these types with different ones or implement them yourself.
If you try to use these methods on the WP8 you get (annoying) messages like these:
Error: method System.Byte System.Net.WebClient::UploadData(System.String,System.String,System.Byte)` doesn’t exist in target framework.
Error: method System.IO.Stream System.Net.HttpWebRequest::GetRequestStream() doesn’t exist in target framework.
Error: method System.Net.WebResponse System.Net.HttpWebRequest::GetResponse() doesn’t exist in target framework.
So after a bit of searching (and alot of trial and error) I arrived at the below code, which works on all platforms.
This is using WebRequests, according to the API for windows phone only certain methods are available so I could only use the async methods, but I’ve written the code so that it appears to be synchronous to the calling method which is what I wanted for my application (as I am calling it from a separate “networking thread” and not in the main thread).
Many times when you are working with CRM it is usefull to be able to get the GUID of a record. It certainly makes my life alot easier when I can tell a coworker exactly which record I'm talking about, or when someone is testing they can give me the guid of the record that does not work.
There is a really simple way of getting the guid using a bookmark in your browser. Heres how to do it:
Now when you want the GUID of a crm record do this:
You should now get a popup with the GUID which looks something like this:
If your are still using CRM 2011 use this code instead:
Functionality such as Split() is for the most of us something we take for granted in whatever programming language we are using.
There is however no Split method in MSSQL. So when I was faced with the problem of splitting strings into multiple rows it got a bit tricky.
I ended up with the function below which will take two arguments, the string to work with, and the separator to split on.
Here is an example of what this code will do: