2

I cannot get any LightSwitch apps to work. When I create a new Project, I add a Table, a Screen, then Debug (F5). But when the application window displays on the screen, it is blank, and an error dialog appears, saying:

Could not load file or assembly 'System.ServiceModel.DomainServices.Client.Web, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I have spent the last two days trying to fix this. I have uninstalled and then re-downloaded and re-installed Visual Studio 2013 Ultimate and Silverlight and LightSwitch all over again - several times. This does not fix the problem.

I have spent hours searching online, finding similar (but not the same) questions with solutions that are not working for my problem I'm experiencing.

I have seen an answer on the MSDN forums saying "Go to Microsoft SDK's folder and in there you will see a RIA Services folder, the DLL's are in there" - there is no RIA Services folder anywhere on my entire hard drive. Also, I did a system-wide search for the particular DLL that it cannot find and the search yielded no results. I also manually went looking for it where it would be found but it's not there.

I have searched the Internet to find out how to install RIA Services. No luck. All I could find were walkthroughs on how to start making apps with RIA, but no install instructions.


Note: Installing everything again does not work in this situation, I've already tried it.


How do I fix this? How can I get my LightSwitch app to work?

uSeRnAmEhAhAhAhAhA
  • 2,527
  • 6
  • 39
  • 64
  • If you have it referenced already (and you're sure of that,) then by any chance in your output window does it list a file path it's trying to find it in that has "/bin" or "/obj/" in the file path? If so just clean the solution (deleting your bin/obj folders) and run it again. – Chris W. Feb 11 '14 at 22:54
  • @ChrisW. Thanks for your reply, it was referenced originally by Visual Studio (I didn't manually reference it, it was done by default when I created a new Project), and it had a yellow Exclamation Mark next to it in References in Solution Explorer. When I righ-clicked and selected Open file location, it took me to a directory that did not exist. The file doesn't exist on my drive. Also, When I restarted VS, it was no longer in the References list and I am unable to add a reference to it myself because it doesn't exist. – uSeRnAmEhAhAhAhAhA Feb 11 '14 at 23:05
  • After posting this question (even though I _did_ search before posting) I found a question _similar_ to mine, and the person suggested to install WCF RIA Services Toolkit. I did that, then restarted VS. I still am unable to reference this DLL. I also then looked in the RIA Services directory (which I now have) and this DLL I need still isn't in there. – uSeRnAmEhAhAhAhAhA Feb 11 '14 at 23:07
  • I seem to have found a workaround. However, my LightSwitch app will not let me add new records when I run the application (which means that the app loads but I just cannot use it to view, add, delete or edit records). I don't know if it has anything to do with the workaround. I'll post an answer detailing the workaround. – uSeRnAmEhAhAhAhAhA Feb 11 '14 at 23:19

3 Answers3

2

What you need is RIA Services Silverlight Client 4.2.0 from the NuGet gallery. I can't find it in the NuGet Package Manager in Visual Studio. Not sure if it's been deprecated or what. I had to download and install it manually.

Here is an SO Q&A that shows how to install it in an older version of Visual Studio and also via the command line. Here is how to install it in Visual Studio 2015 Community:

Tools - > NuGetPackage Manager -> Package Manager Settings

Add a new Package Source that points to the directory where you saved the above file.

Package Sources

Right Click on your Client project and select Manage NuGet Packages. Change your Package Source to your newly added source in the upper right hand corner. Then there should be an Install button where the grayed out Update button is in the following picture.

NuGet Package Manager

embedded.kyle
  • 10,976
  • 5
  • 37
  • 56
0

I have found a workaround for the time being. Visit this page and download the source code sample.

Right-click the zip file > Properties > Unblock (if you used IE to download it). Then go to Getting Started - WCF RIA Services > C# (or VB) > HRApp > Bin > Debug > Then reference the System.ServiceModel.DomainServices.Client.dll and System.ServiceModel.DomainServices.Client.Web.dll files in your LightSwitch project.

Rebuild and Debug. It should now be working.

uSeRnAmEhAhAhAhAhA
  • 2,527
  • 6
  • 39
  • 64
0

I found adding the NuGet package RIAServices.Server fixed this for me. This is because these are older services which may not be installed on newer machines