A simple way to improve intellisense in Visual Studio for Mac

I found a intellisense setting in Visual Studio for Mac that makes me write code way faster. I turned on "Show import items", after that I will get code completion even for classes that are in namespaces that I don't have added a using for. I think it makes me write code faster and it help me to find classes that I'm not completely sure what the name is.



To turn it on open "Preferences" and go to "Intellisense" under the "Text Editor" header. And then check "Show import items"


Tool for previewing XAML – LiveXAML makes your life a little bit easier

Since Xamarin.Forms was introduced many has asked for a visual designer for building user interface like the one we have for building WPF or UWP apps. But I don't think it is many that uses it like a designer, I think it is mostly used like a previewer of the XAML that you are writing. At least I use it that way.

Xamarin has tried with Xamarin.Forms previewer, but I have never got that work in real scenarios. But it will be great if they could get it work for real. Xamarin also has the Xamarin Live Player that makes it possible to debug iOS and Android apps on a device via WiFi. You don't even need a Mac to debug iOS apps. The only thing you need to do is to download the Xamarin Live Player app and pair it with Visual Studio (works on both PC and Mac). With Live Player you can also live view XAML views, it makes it possible to make changes and see the result on a device without redeploy it. But I have had some problems with it, it can be complicated to pair Visual Studio with the app, especially if you're on an enterprise network. I have also facing issues with more complex scenarios, for example if I have creating my own base views. But Live Player is still in preview, so I am looking forward to a stable product.

My favorite tool right now is LiveXAML (https://livexaml.com) that makes it possible to edit XAML when you're debugging. You just start the app and navigate to the view you want to edit. When you save the file, you will see the changes live in the app. It works both on Visual Studio for Mac and PC and on both on simulator/emulator and on real devices. It cost $240 or $24 per month. But it's nothing seen to the time you will save when you don't have to redeploy your app to see small UI changes.

Gorilla Player is a similar tool to LiveXAML that are free and could be worth taking a look at. But last time I used it I think it was more complicated to get it to work if you compare to LiveXAML, but they have probably improved it since I used it.

Dependency Graph with NDepend

Right now I evuluating a new software called NDepend. NDepend is installad as a Visual Studio plugin. I havn't use it much yet, but I have already found a feature that I like a lot. It is the dependency graph. The graph show how assemblies is related to other assemblies in your Visual Studio solution and to external assemblies. You can easily show information about an assembly buy hover over an assembly in the graph.

With Visual Studio Ultimate you can generate dependency graphs out of the box. But I think that the tool for dependency graphs in NDepend gives me a much better overview than the tool in Visual Studio Ultimate and  it much easier to use.

When I have evulated it more I will write a full review of the software.



Problems with Xamarin iOS project and web project in same solution

In my Visual Studio solution I have both client projects and server side projects. The client projects are for Windows Phone, Xamarin iOS, Xamarin Android and WPF. The server side project is a Mobile Services .NET backend project.

My problems started yesterday when I would publish the latest update of my backend to Azure. I right clicked on the project and hit publish, then shown a dialog with the following text "object reference not set to an instance of an object". To verify if it was a problem with my project or with Visual Studio I created a new solution with a new Mobile Services .NET project, and it worked. Then added the project from the old solution to the new solution and it worked. Then I started to think about the diffrences in my both solutions, so I added new client projects. After that I have added a new iOS project I got the same error when I trying to publish the Mobile Services project to Azure. When I removed the iOS projects from the old soultion and restarted Visual Studio it worked there to.

I also tried to create a new solution with a MVC project and a Xamarin iOS project to investigate if the problem was just for Mobile Services projects or for all web projects. It looks like the problem is for all web projects when you have a Xamarin iOS project in the same solution.

I using Visual Studio 2013 with update 2.

TypeScript will not compile on save in Visual Studio 2013

It seems that many having problem that TypeScript not will auto compile on save in Visual Studio 2013. TypeScript was earlier a part of the Web Essentials extension, but it is not included anymore. So the first step is to ensure that the TypeScript plugin is installed, if not it is available for download here, http://www.microsoft.com/en-us/download/details.aspx?id=34790.

If you still have the problem you need to activate auto compile on save for TypeScript.

To enable auto compile on save for TypeScript follow following steps:

  1. Go to Options under the Tools menu.
  2. Expand options for Text Editor
  3. Expand options for TypeScript
  4. Expand options for Project
  5. Check "Automatically compile TypeScript file which are not part of the project"

That helped me when my TypeScripts not compiled on save.



Workaround for invalid markup problems when developing for Windows Phone

Every time I open up a Windows Phone Project in Visual Studio 2013 I got a lots of  errors in the XAML markup. The designer shows "Invalid markup" and the error list is long. I found a workaround for this:

  1. Open Configuration Manager for your Visual Studio solution
  2. Change platform for the Windows Phone Project to x86
  3. Build the Project and the errors is gone
  4. Open Configuration Manager again and change back to "Any CPU"

After follow above steps it will work until you start Visual Studio again.

Windows Azure Mobile Services in Portable Class Library

In my current project, a multiplayer game for mobile devices I only using Windows Azure Mobile Services as backend. The game will be available for multiple platforms and I will use Xamarin for iOS and android.

When using Xamarin I can reuse a lot of code if I using PCL (Portal Class Library) that i shipped with Visual Studio. When creating a new PCL-project you can choose which taget platforms the project will build for, in my case Windows Phone, Windows Store, Xamarin iOS and Xamarin Android.

In order to reuse so much code as possible I want to have the communication with my backend in PCL. When using Windows Azure Mobile Services I can have all communication there except for the code for authentication. But then I put an interface i PCL and each platform will have a specific implementation of the interface.

But where to find the Mobile Services assemblies for PCL? I installed Mobile Services via NUGET to my Windows Phone project (Windows Phone is my first platform). But Mobile Services was not just installed to my Windows Phone project, I also got the assemblies for PCL (and other platforms) i my packages folder. It enabled me to add the assemblies manually to the PCL-project.

Solution: Web role deploy problem with Azure SDK 2.2

When I updated my Windows Azure SDK to 2.2 I got a problem when deploying the package of my MVC 4 web site from Visual Studio to a web role in Windows Azure. The message I got was that a exception has occored under recycling and that I should check for unhandled exceptions or configurations errors.

Finnaly I found the solution, setting Copy local to true on the reference to the assembly for WindowsAzure.ServiceRuntime made it work again.

Visual Studio performance and local workspace for TFS

I have had performance issues with Visual Studio for a long time. For example open projects, adding files and installing NuGet packages had taken very long time.

Last week I talked one of our TFS experts at Sogeti and he asked me how many files I had in my TFS workspace. I had more than 60 000 files in the workspace. I said that it could be the problem.

When using local workspace, Visual Studio scanning the file system for changes. If a workspace contains more than 50 000 files it could affect the performance.

I tried to split my workspaces into smaller parts, and he had right, Visual Studio is much faster now than before.

The conclusion of this is, try to keep your workspace as small as possible and if you have to have a workspace that contains more than 50 000 files, use server workspace instead.

Extensions for Visual Studio 2012

Visual Studio 2012 is a very good tool out of the box. But with a few extensions it will be even better. I using following extensions:

ReSharper 7
I can't live without it! It makes my day much more effective.

VSCommands - Free
The feature I use most is the button that attach the debugger to IIS-processes.

Productivty Power Tools - Free
An add-on with small feature thats makes me more productive.

Web Essentials - Free
An extensions with a lot of features that helps me with my web projects.

TFS Power Tools - Free
Adds extra features fot Team Explorer. For exampled it adds more check in policies.