Tag: VS2010

Changes of WCF RIA Services for Visual Studio 2010

This blog post, Changes of WCF RIA Services for Visual Studio 2010, is very handy when upgrading code using previous versions of WCF Ria Service.


Error occurred in deployment step ‘Activate Features’: Failed to activate feature ‘SiteDefinition1_Feature1’ (ID: b2637aff-6c72-4ec9-9a44-3f10d8e46714) at scope ‘http://…’.

I started getting this error when deploying my custom SharePoint Server 2010 site definition, which was little weird, because it was working and then it suddenly stopped. After trying a few different things, I closed down Visual Studio 2010, and left it at that, while attending to some other business. When I came back and reopened the solution, everything worked fine again, and after a “little” investigation, it turned out to be because I had deleted and recreated the site collection, which was used for debugging.

The "CreateRiaClientFilesTask" task failed unexpectedly.

I started getting this error message, after installing SP1 for Visual Studio 2010.

The “CreateRiaClientFilesTask” task failed unexpectedly.
System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.
   at System.IDisposable.Dispose()
   at Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask.GenerateClientProxies()
   at Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask.ExecuteInternal()
   at Microsoft.ServiceModel.DomainServices.Tools.RiaClientFilesTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) 

It turns out that some sort of locking is the culprit, so simply shut down the ASP.NET Development Server and rebuild your solution.

—————————— UPDATE ———————————–

If the ASP.NET Development Server hasn’t been started yet, or you are using IIS, you need to close down VS 2010, and restart it.

Remove indentation temporarily for Visual Basic code in Visual Studio 2010

I guess the subject line pretty much says it all… Anyway, I do a lot of documentation on Visual Studio, ASP.NET, Visual Basic, and Visual C#, and I therefore often need to copy code I have created from my development VMs to my Word documents. Now, for blocks of code that is indented in the Code editor in Visual Studio, it is handy to be able to remove the indentation before copying it, but the default set up for Visual Basic prevents this. Turns out it is because it automatically formats the text when you unindent.

Fear not, just click Options on the Tools menu, to open the Options dialog box. In the Options dialog box, in the left pane, expand Text Editor, expand Basic, and then click VB Specific. Clear the Pretty listing (reformatting) of code check box, and click OK.

If you don’t want to turn it back on, you can always resort to using CTRL+K, D to format the open document.

Could not load type ‘System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider’.

I got this error when upgrading from RC1 of Visual Studio 2010 and the .NET Framework 4.0 RC1, to the RTM version of both. The fix is simple, very simple; simple add the outlined markup to your web.config file.

     <compilation debug="true" targetFramework="4.0">
         <add assembly="System.Security, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
         <add assembly="System.Data.Entity, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
         <add assembly="System.Data.Entity.Design, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
         <add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />

The operation could not be completed

I get this error, The operation could not be completed, quite frequently in Visual Studio 2010 Beta 2 and to my knowledge, I only get it when double-clicking a code file, .cs or .vb, in Solution Explorer. If I try again, the same thing happens, the Microsoft Visual Studio dialog box, pops up with the error message. Short of closing down Visual Studio, which does work, simply open the associated markup file, if you’re trying to open a code-behind file, right-click anywhere in the Text editor containing the markup, and then click View Code. Alternatively, right-click the code file in Solution Explorer, and then click Open. Rather simple, but you don’t always think about it, when you get set in your ways of doing things. 😉

Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

Lately, I’ve been getting this quite a lot on my development VM. I have a SQL Server 2008 Express Edition database in the App_Code folder of my Web site, and sometimes when I get the error, closing down the browser and running the Web site again from within Visual Studio solves it. However, more often than not, that doesn’t do it. Stopping the ASP.NET Development Server doesn’t fix it either nor does closing down and reopening Visual Studio.

What does the trick, is to clear the items in this folder, %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS. If the files are locked, you’ll need to reboot your machine, and delete the files before you run your Web site again.

You can also open up the Task Manager and delete all sqlservr.exe processes, but I think a reboot is better…


It turns out that you don’t have to delete the files, but simply kill the sqlservr.exe process that runs under your account (the logged in identity). Much easier…

Randomly assigned ports in ASP.NET

By default, Visual Studio and Visual Web Developer Express, randomly or dynamically assigns a TCP port to a new Web Site or Web Application when you create them. This is just fine when you’re testing functionality, but not so when you need to test access etc. after moving it to IIS. Now, here is how you change it:

Web Site Project (WSP)

  1. Right-click the Web site in Solution Explorer.
  2. Press F4 to open the Properties window, if not already open.
  3. In the Properties window, click False in the Use dynamic ports list.
  4. In the Port number box, type the desired port number.


Web Application project (WAP)

  1. Right-click the project in Solution Explorer, and then click Properties.
  2. In the Properties dialog box, click the Web tab.
  3. On the Web tab, click the Specific port option, and type the port number in the box next to the Specific port option.
  4. Close the Options dialog box.