Category Archives

Solving the #Xamarin error “Unable to copy appname.dll…”

.NET, Technical stuff, Visual Studio, Work, Xamarin
No Comments

If you recently updated Xamarin to the latest stable version in Visual Studio 2015 or Visual Studio 2017, you might have encountered an annoying error when trying to build:

Unable to copy appname.dll from obj to bin because it is being used by another process

This error typically happens the second time that you try to build after you start Visual Studio. The first time everything works OK, then suddenly you cannot build anymore. Cleaning the solution doesn’t help, the only “fix” is to restart Visual Studio which is of course really annoying when you are developing.

This error is known, as shown by the Bugzilla issue #56275. There is also an old forum discussion on the Xamarin forums, which is a bit confusing because it might be a recurring error in the Xamarin updates.

Fortunately, the Bugzilla discussion also carries a workaround. This is a Visual Studio extension that you can install, which should fix the issue. I also talked to Microsoft about this and got confirmation that the error is fixed in a future release of Visual Studio. The engineer who replied to me also gave me a VSIX to fix the issue. I am not entirely sure what the difference is with the one in the Bugzilla issue, so I will just copy it here for your convenience. As far as I can tell, both VSIX files work well.

Happy coding
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)
Share on Facebook
 

Using the Windows Template Studio with #MVVMLight

.NET, Build, MVVM, Technical stuff, Universal Windows Platform UWP, Visual Studio, Windows 10, Work
1 Comment

Here is a story of a great collaboration between Microsoft and the community.

Last year in August, as I was speaking at VS Live in Redmond, I was asked by my friend Clint Rutkas for coffee because he had an idea he wanted to run by me. Now if you know Clint, that is usually really intriguing and I was really excited to hear about his idea.

Clint told me about the project he was thinking of starting. This was just conceptual at the time, but his idea made a lot of sense: Why not make the process of creating a new Universal Windows application a lot easier. Why not help people with all the tedious tasks that you get right after File, New, Project.

Usually when you get started, you need to add a bunch of pages and helpers to your application. The Blank application template is just that, blank. In MVVM Light, I added a project template for the supported frameworks (Universal Windows Platform, Xamarin.iOS, Xamarin.Android, Windows Presentation Foundation, Silverlight).

2017-05-24_11-09-27
The MVVM Light templates in Visual Studio 2017

However creating a meaningful project template is really difficult. You are constantly navigating between “too much content” and “too little content”. If you have too much, the developer ends up having to remove a whole lot of code, which is tedious. If you have too little, then the developer needs to spend time adding the basics, as well as sometimes having to look for guidance on how to do common things like navigation, dialogs, a Settings page, etc.

Building a wizard

Of course I thought of building a wizard to help people getting started. This is not easy though. First of all, the Visual Studio automation can be complex. You need to support multiple versions of Studio, and the extensibility model changes from version to version, so that is a big commitment. And this is where Microsoft has a huge advantage, they own the extensibility model, they know in advance is something is going to change, and they have the resource to create and maintain the code. And since the WTS is open source and available on Github, you can also contribute, and help make this project even better.

Installing the Windows Template Studio

Before you get started, you will need to add the Windows Template Studio (WTS) to Visual Studio 2017. Thankfully this is really very easy. In Visual Studio 2017, just select Tools, Extensions and Updates. Click the Online item on the left, and enter Windows Template Studio in the search box on the top right.

2017-05-24_09-47-08
The Extensions and Updates dialog with WTS

In Visual Studio 2017, you are now required to close the application to install the extension, so after the download is complete, close Studio and it will get installed.

Getting started

2017-05-24_11-16-46

The WTS starts in the File, New, Project dialog. Under the usual Universal Windows templates, you will see the entry for the WTS. Select it, give a name to your new application and press OK.

The project type

2017-05-24_11-19-16
The project type and framework dialog

The next screen is about the foundation of your app. You can select a type of navigation (currently you can select an app with a navigation pane, or an app with tabs), or simply a blank template without navigation.

The framework

Then comes the framework selection. This is where you will notice MVVM Light front and center. The other options at the moment are Code Behind, or a basic “no-name” MVVM implementation which can be useful in situations where the usage of 3rd party frameworks is completely forbidden.

The pages

2017-05-24_11-20-12
The pages dialog

The next step is probably the one I am the most excited about. It is usually so tedious to add the same pages over and over in every application I create. Here, you can choose to add pages such as blank page, map page, master/details, web view, settings etc. I can’t stress enough how much of a time saver this step is.

Note that the studio also supports you in finding out which licenses the 3rd party frameworks use. For example, if you add a Settings page which uses JSON.Net for the serialization of the settings, a link to the license is added to the Summary pane on the right, and so you don’t have any surprise.

The features

The features dialog is as exciting. With one click, you can add new experiences to your application such as Suspend/Resume, Background tasks, notifications, live tiles and more.

2017-05-24_11-54-40
The features dialog

This is probably the easiest way to offer a fully featured application to your users.

Why only MVVM Light at this time?

Microsoft ran numbers of the Nuget downloads and saw a confirmation that MVVM Light is the most widely used framework to build MVVM applications on Windows. In addition, its modularity and simplicity of use makes it a prime candidate for the first version of the WTS. However this is an open source project and so the developers of other projects (such as my good friends at the Prism or MVVM Cross projects) are already working to add support for their own framework in the WTS.

What about other application types?

At the moment, the WTS only works for Universal Windows applications. However nothing would prevent it to be updated for other application types. Personally I would welcome Xamarin support! And here we can predict that this will probably happen sooner or later, supported by the community of open source developers. I can see a lot of advantages in adding support for Xamarin or even WPF desktop applications. So I encourage everyone to head to Github and start contributing!

Resources

Here are some videos and links to get started:

I hope that you also see the potential of this great tool and that you will contribute.

Happy coding!
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)
Share on Facebook
 

Live blogging the Microsoft Build keynote, day 2 #msbuild

.NET, Build, Conferences, Technical stuff, Universal Windows Platform UWP, Visual Studio, Windows 10, Work, Xamarin, XAML
No Comments

And the show continues on day 2! In this post, I will be live blogging the Microsoft Build keynote on day 2. This should be a very exciting event with focus on client development, Windows and Mixed Reality. Get ready!!

Live blogging the Microsoft Build keynote, day 1 #msbuild

.NET, Build, Conferences, HoloLens, Technical stuff, Universal Windows Platform UWP, Visual Studio, Windows 10, Work, Xamarin, XAML
No Comments

Build day 1 is a wrap and you can find all the live notes taken during the keynote in this post!

My plans for Build 2017 #msbuild

.NET, Blog, Build, Conferences, Technical stuff, Universal Windows Platform UWP, Visual Studio, Windows 10, Xamarin
No Comments

Days are passing and the time is getting closer to pack my stuff and fly to Seattle again. This will be my first trip to my third home this year, and I am really impatient to be there. I just love that place.

Getting there

I will be arriving in town on Saturday evening, quite late. My plan is to pick a rental car and get to the hotel in Pioneer Square and get to bed :) The next morning, based on experience, I will be up super early (thank you jet lag). This is a droning day! I am not 100% sure yet where I will drive but I am considering getting close to Rainier National Park if the weather is good enough. Alternatively maybe take the ferry to Bainbridge to make footage of the islands. Or maybe the Snoqualmie area. Or maybe all of the above. This will be a day like I love, driving around on my own schedule, relaxing, flying, filming, editing pictures at a cafe… Should be a lot of fun if the clouds are cooperating!

Visiting the office

Monday will be an office day. Seattle is an important hub for Valorem, and this is the office where it all started for me. I love going there and seeing the new and improved space. So as usual I will be looking forward to meet new colleagues and meet old colleagues again!

The conference: Live blogging

During the conference itself, I will try something new this year: I will be live blogging the keynotes and the sessions that I can attend. In previous years, I was always taking notes during the events and posting these notes to my blog every so often. Surprisingly, this has been quite popular, even though these are my raw notes without much commentary. I found out that not everyone can watch the live stream, and people were reading my notes and getting some of this keynote feeling there. But of course posting a blog post is a lot slower than taking the actual note. So this year I installed a new plugin on my blog called 24LiveBlog. This will allow me to publish my notes about the keynote in real time as well as hopefully post pictures too. That should be a fun exercise!

You will be able to follow the live blogs at the following URLs. However please note that these links will only be active on and after the keynote day 1 and 2 respectively!

Keynote day 1 (Wednesday May 10, 2017): http://blog.galasoft.ch/posts/?p=1601
This keynote will take place from 8AM to 11AM PST
(4PM London time, 5PM Zurich time).

Keynote day 2 (Thursday May 11, 2017): http://blog.galasoft.ch/posts/?p=1606
This keynote will take place from 8:30AM to 10AM PST
(4:30PM London time, 5:30PM Zurich time).

I am really looking forward to this exercise and hope that it will be useful to you all!

Wednesday: Mix2017 party with iHeartRadio and Valorem

Yes yes I know, the name is really significant… this is not a revival of the MIX conference! I know we all miss this amazing conference… No, the Mix2017 event is Valorem’s and iHeartRadio’s party at Build!

Join iHeartRadio and Valorem for #Mix2017, a fantastic night where music meets mixed reality. iHeartRadio’s DJ will mix your favorite music and Valorem will mix your reality with exciting HoloLens experiences on Wednesday, May 10, at the Living Computers Museum + Labs. As a bonus, event attendees get free admittance to the museum.

More details and registration on the Valorem website! I hope to see many of you at this event!

Happy coding!
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)
Share on Facebook
 

Enabling / Disabling design data in Visual Studio 2015 Update 1

.NET, Blend, MVVM, Technical stuff, Universal Windows Platform UWP, Visual Studio, Work, XAML
No Comments

If like me you use design time data in Blend or the Visual Studio designer, you may have noticed a small change that is actually very convenient, but maybe not the most discoverable feature ever: You can now switch design time data on or off very easily!

To illustrate this, follow the steps:

  • Start Visual Studio 2015 Update 1.
  • (if you have not done so already) Install MVVM Light with: Tools / Extensions and Updates / Online –> Search for mvvm light and install the extension.
  • After restarting Visual Studio, select File / New Project and create a new MvvmLight (Win10Univ) application. This will create a new Windows 10 Universal project with all the MVVM Light scaffolding.
  • Open MainPage.xaml in the Visual Studio designer (or select Design in Blend from the context menu on MainPage.xaml).
  • Make sure that you set the configuration manager to x86 (not ARM or x64).
  • Build the application.

At this point, you will see one of two images below:

2016-02-29_14-10-21

Figure 1: Design data is enabled

 2016-02-29_14-10-48

Figure 2: Design data is disabled

What’s the difference?

If you study both figures closely, you will see the difference at the bottom: Figure 1 shows actual data created in the code of the MVVM Light application (“Welcome to MVVM Light [design]” and the “Starting…” label for the Clock), while figure 2 shows the names of the databound properties (WelcomeTitle and Clock) instead. Switching from one figure to the other is done by using a new button on the design surface, which is a little hard to find. Here is an illustration:

2016-02-29_14-16-09

This small button is tooltipped “Enable Project Code”.

What this button does is enable or disable a feature that MVVM Light applications are taking advantage of: The possibility to run some of your app code while the application is loaded in the visual designer. If the button is toggled on, the design time code will be enabled, which explains why the WelcomeTitle label shows the design time text, and the Clock shows the initialization text. This is useful, because it will allow you to design your app visually without having to actually run it, and so you will be faster.

On the other hand however, design time code can crash the visual designer. This type of errors can be fixed by updating the design time data, but they are time consuming, and sometimes it is just not worth it. In those cases, you may want to disable the design time code for the current view, which can be done by toggling the small button off.

In the case where the button is disabled, you can still edit the UI somehow, because the name of the property will be shown, and you can at least set the font, font size, foreground color  etc, which is better than nothing. For lists, this works too: If the design time code is enabled, the design time elements will be shown like in figure 3. On the other hand, if you disable the design time code, three “dummy” items will be created, which allows you to edit the item template visually. Here is an example taken from an app I am currently working on.

 2016-02-29_17-30-17

In addition, it also enables some level of design work with configurations that were not initially supported by the visual designer: ARM and x64. You can verify this by changing the configuration in the MVVM Light application above. Here the toggle button becomes disabled, and the view in figure 2 is displayed.

Having the possibility to disable design time code renders the visual designer more stable by allowing the user to eliminate possible design time error from the equation, and to still use the designer even if the design time code fails. It also allows some level of designer usage even with ARM or x64 configurations. This should accelerate things especially towards the end of the project, when maintaining the design time data can be time consuming.

Happy coding
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)
Share on Facebook
 

Watch the Connect() online conference on GalaSoft.ch!

Technical stuff, Visual Studio, Website, Work
No Comments

On November 18th and 19th, you can watch the Connect() online conference streamed LIVE on http://www.galasoft.ch and also directly here on this blog article.

Read the rest of this entry »

Upcoming speaking engagements and travels!

.NET, IdentityMine, MVVM, Technical stuff, Visual Studio, Windows 10, Work, WPF, Xamarin, XAML
1 Comment

Wow it’s autumn already! When did that happen? The Summer was very busy, with a lot of super interesting work at IdentityMine, the release of MVVM Light V5.2, and preparation for an upcoming article in MSDN Magazine (more about that later) and even some work on some personal apps I wanted to port to Windows 10 and improve.

In the coming few weeks, I have some travel coming up, with speaking engagements. Here is the list below, and I will update it if something new comes up. I really hope to have a chance to see you at one of these talks, and if you do come, please come say hi and let’s chat!

Read the rest of this entry »

What is the “ApplicationInsights” package in Windows 10 universal apps, and do you need it?

Technical stuff, Universal Windows Platform UWP, Visual Studio, Windows 10, Work
No Comments

When you create a new Windows 10 universal application in Visual Studio, you might have noticed that a reference to Microsoft.ApplicationInsights is added to the references folder. In fact, there are three Nuget packages, and one ApplicationInsights.config file in your project. So what is this, and can you remove it?

Read the rest of this entry »

Announcing MVVM Light V5 for Windows and Xamarin

.NET, Blend, MVVM, Phone, Silverlight, Technical stuff, Visual Studio, Windows 8, Windows Phone, Work, WPF, Xamarin, XAML
53 Comments

Here at the Xamarin Evolve conference in Atlanta, I just announced the immediate availability of MVVM Light V5. This version runs on the following platforms:

  • Windows Presentation Foundation (3.5, 4, 4.5, 4.5.1)
  • Silverlight (4 and 5)
  • Windows Phone (7.1, 8, 8.1 Silverlight, 8.1 RT)
  • Windows Store (8, 8.1)
  • Xamarin Android
  • Xamarin iOS
  • Xamarin Forms

Read the rest of this entry »