Missing StoreKey PFX certificates when building a Visual Studio 2019 UWP project

I came across an interesting issue updating my UWP app to Visual Studio 2019 and a new Azure DevOps pipeline. “Associate with Store” no longer adds password-less PFX files named *TemporaryKey.pfx and *StoreKey.pfx to your project to sign your store submissions – instead in VS2019 it now adds the certificates to your local user store only.

Which means when it comes to build, you get errors like

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(4353,5): Error APPX0102: A certificate with thumbprint '' that is specified in the project cannot be found in the certificate store. Please specify a valid thumbprint in the project file.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(4353,5): Error APPX0107: The certificate specified is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478.

For comparison:

Above: Visual Studio 2017

Above: Visual Studio 2019 – notice the options to select from file and create test certificate are no longer.

To fix this for Azure Devops, you’ll need to install the PFX private key on every build. Follow these steps:

  • On the Choose Certificate window (shown above) choose View Full Certificate
  • On the second tab, choose “Copy to file…” to start the export to PFX process
  • Export the private key to a password protected PFX file
  • Add the PFX file to your project directory, like where it used to be in VS 2017
  • Update your .csproj file, adding a <PackageCertificateKeyFile> element containing the filename alongside <PackageCertificateThumbprint>
  • Add your PFX to source control making sure it is not ignored
  • In Azure Devops Pipelines, you’ll need a quick Powershell build step to add the certificate to the local user store:
  • Make sure that the WorkingDirectory option is set to the folder with the PFX file (alongside the .csproj) file.

That Powershell script in full:

$pfxpath = 'MySigningKey.pfx'
$password = 'supersecretpassword'

Add-Type -AssemblyName System.Security
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($pfxpath, $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]"PersistKeySet")
$store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", CurrentUser
$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]"ReadWrite")
$store.Add($cert)
$store.Close()

Now when your app is built, the private signing key will be loaded from the local machine store.

A note on security

The above is a quick and dirty way of getting this working – adding a PFX file to your source code repository is not best practice and you shouldn’t do this if you can help it. This is probably why Microsoft changed this behaviour in VS2019. An improvement on this could be to use the Secure Files feature of Azure DevOps to securely hold the PFX file until the build templates have a decent way of handing this scenario.

 

 

 

 

Why use a Macbook Pro as a Windows .NET Software Developer (Updated)

Update December 2016: Apple has released a new version of the MacBook Pro featuring the new Touch Bar feature. I do not recommend buying this model.

  • Worse battery life
  • Worse keyboard
  • Touch Bar feature is pretty useless for Bootcamp or virtualization – you will miss the usual function keys
  • USB-C only. Expect to spend 100s on adapters.
  • The original Bootcamp drivers actually physically blew the speakers when running Windows

Luckily Apple still sell the 2015 model without Touch Bar. I would recommend buying one of those.

Original post continues below…

I’ve been using OSX alongside Windows for almost 8 years now. In this post I will outline why a Mac is handsdown the best development laptop you can buy even if you are primarily a Windows or .NET developer. I use a Retina Macbook Pro 13 inch at home and for side projects, plus a Retina Macbook Pro 15 inch at work.

image

Reason 1: You need access to OS X as a professional software developer

If you care about maximizing the value you can provide as a practitioner of building software, you need access to OS X. OS X is the only way to build native iOS applications – and as a .NET developer without access to OS X, you’ll never even be able to use Xamarin to run your C# code on iOS natively. You’ll also miss out on the wider community and the rest of the development world – Javascript, Ruby, Python and Scala developers all use Unix-based operating systems to do their work, not Windows, and most of the time their preferred platform is OS X. If you want to dabble in Ruby over the weekend, or even teach yourself a new skill, OS X on a Mac is the only way to get first class support as most non-.NET/Java developers run their stuff on Macs (a small minority use a Linux distribution to do their work). No laptop other than a Macbook Pro or Air will give you access to this world and you will find yourself increasingly isolated professionally if you can only use Windows.

Reason 2:  It’s the only laptop that lets you run OS X and Windows at the same time

Since Apple put Intel chips in their machines, you’ve always been able to run Windows natively on a Mac by creating a second partition using the built-in Bootcamp utility. Since the middle of 2014, this has gotten even better with the introduction of native UEFI support. Gone is the 80s-era BIOS emulation, and now Windows boots just as fast as OSX itself. The Windows 8 startup circle animation even starts rendering before the Mac bootup sound finishes playing.

You don’t have to reboot when you want to use Windows – you can attach that same native partition within a virtual machine using Parallels or VMWare Fusion. That means you can run both OSX and Windows side by side, rebooting into the native Windows partition when you need the full power of the machine. Plus, its really cool to be able to do this:

Swiping between OSX and Windows

(As a side note, I get much better performance out of Parallels Desktop 10 than VMWare Fusion when running Windows 8.1 or the Windows 10 Tech Preview – the Parallels virtual display driver is WDDM 1.2 compatible, rather than VMWare’s WDDM 1.0 compatible version. WDDM 1.0 is from the Vista era.)

Reason 3: Multiple monitor support is amazing

All the Retina Macbook Pros have two Thunderbolt ports, which double up as Mini DisplayPort ports, and an HDMI port. The Retina Macbook Pro 13 inch can support 2 external monitors under OSX, and three under Linux or native Windows. The 15 inch version can support 3 external monitors and the internal screen at the same time. Both these limits can be extended by using USB 3.0 “DisplayLink” adapters or docks at the cost of CPU power and graphics quality. With virtualisation, you can set Windows up to use any number of monitors.

Reason 4: You can test your work on multiple retina display implementations

Both the 13 inch and 15 Retina Macbook Pros have amazing high resolution screens. If you are building web applications, you need to be able to test your work on “retina” displays and this is the quickest way of doing it, without getting a 4K monitor. Most retina displays in the wild are on Apple devices too (iPad, iPhone etc). The ridiculous resolution of the 15 model (2880×1800!) even enables you to test your apps and sites in Windows at up to 200% DPI scaling without an external monitor.

Reason 5: The Apple Store retail support network

Say what you want about the “cult of Mac”, they have retail support available in almost every major city on earth through their Apple Store network. If you need a new charger or accessory, you can walk in and buy one from an actual shop. If you have a problem, you can go in and (sometimes pay for) a repair – not phone an offshore support line and get a box posted to you. Acer, Dell, Samsung etc do not have the meatspace reach of Apple (unless you like to shop at PC World). The thought of having to buy a replacement AC adaptor for a “Acer Aspire S3-392G” machine at short notice is quite scary. If you have a preference for the US keyboard layout, a Mac is the only laptop stocked in retail available with a selection of keyboard layouts – when in Tokyo, Apple were the only people in the whole city that stocked laptops with US keyboards.

Reason 6: The .NET Framework is becoming multiplatform

In case you missed the news, Microsoft have committed to making the core of the next .NET Framework version work on both Linux and OSX, instead of leaving it up to Mono to provide an implementation. This is a direct result of the leaders in the .NET space stretching C# out of it’s comfort zone of Windows and Visual Studio. ASP.NET vNext supports development using Sublime Text on a Mac. The OmniSharp project brings C# support to Sublime text, Emacs and Atom. Visual Studio is not required. From 2016 onwards, I expect ASP.NET vNext to start featuring in C# developer job ads, and they are going to expect you to be able to at least run applications without Visual Studio. Deployment of greenfield applications to Linux servers using Docker containers will start becoming the norm from next year.

In Summary

I haven’t even touched on the other reasons why this is now my preferred setup – the now native SMB 2.0 support in OSX, OneNote finally on Mac, the quality of the keyboards and trackpads – but using non-Apple laptops is painful sometimes. I was once issued the 2nd generation of the fabled Lenovo Thinkpad line of X1 Carbons that got rid of the function keys and replaced them with comedy touch “context sensitive media buttons” (the 3rd gen reversed this bonkers choice). My last two companies have eventually managed to sort out a top of the line 15 inch Retina Macbook Pro as my corporate machine and thanks to the proliferation of Macs in the corporate setting, IT departments are slowly warming up to the idea.

If you have any questions about how I use the above, drop me a line in the comments or send me an email and I’ll be happy to respond.

Why I won’t be returning my Microsoft Surface RT

I’ve picked up a Microsoft Surface RT from the “temporary” New York Times Square Microsoft Store. While the purchasing experience was a bit of a mess (untrained sales staff – I ended up having to type my own details into their POS terminal as I’m not quite sure the guy knew how to type), I managed to make off with a properly boxed (I skipped getting the staff to unbox it and walk me through the “Out of Box Experience”) 32GB Surface, Type Cover and VGA adapter.

The device

This is an amazing piece of hardware. I’ve dabbled in and out of portable computing ever since the original Windows Tablets in the form of the HP TC1100. The TC1100 was ahead of its time – a full version of Windows in a tablet with a decent attached keyboard that went together to make a case. However, the hardware was pretty bulky – fans and a display too far away from the glass, making touch, even with the included stylus, inaccurate.

This really looks like something out of a Bond film. The tapered edges and kickstand both apparently go off at 22 degrees (I haven’t measured), looking deliberate – as if designed by actual designers. I would not be surprised if some ex-Apple guys worked on this device. The battery is said to go 10 hours of mp4 video – more than enough for a long haul flight, and I can personally attest to the quick charging of the Surface up to around 50% in about an hour. The camera is at an angle to compensate for the slant when using the kickstand. Portrait mode looks slightly ridiculous, but I can’t imagine using it in portrait when just sitting the device landscape in your lap works so well.

The Type Cover is like nothing you’ve seen before – forget the comedy Bluetooth “keyboard covers” for iPad users desperate to do a bit of actual work on their devices – this is genuinely a pleasure to use. The small multitouch trackpad is great, but strangely defaults to inverted scrolling like OS X Mountain Lion. My only gripe is that they still have the Caps Lock key – I will have to delve into the Registry to switch this to a Control key. Yes, I did say Registry…

The software

Windows RT is installed by default and is the most fascinating part of the device. Many pundits have long called for Microsoft to abandon backwards compatibility and build a new operating system – if they did, it would look something like this. Windows RT is Windows 8, but without the backwards compatibility legacy. The full Windows desktop is here – the Command Line, PowerShell, Windows Explorer, Paint, Notepad, VPN connections, BitLocker – the works. The only difference is that WinRT only allows Microsoft-signed applications to run on the desktop. Visual Studio 2012 can build ARM applications but this is blocked by Microsoft – bypass the block with a registry setting and the compiled binaries are blocked by Windows RT. I suspect this is because the device is subsidized and they hope to recoup revenue from the Windows Store apps, but it might just be a ploy to force developers to build Metro-style applications. The thicker, heavier, noisier Surface Pro is due soon and will run the full x86 Windows 8 Pro, bringing legacy support with it.

If the Surface RT is meant to be used as a main or only machine, this is going to cause problems. In the Microsoft Store, non-technical members of the general public were already asking if they “could use their iPhone with it” – yes, they can, but only to charge and download photos. iTunes will not install. Firefox will not install. Even some Windows Store Metro apps will not work – notably Google’s suite. If you or your company uses Google Apps, steer clear from Windows RT until Microsoft or Google budge and allow Google Drive syncing. There could be serious backlash due to Windows RT – if enough customers kick off a storm, Microsoft might remove the signature check when running ARM binaries, allowing third-parties to treat Windows RT like a first class citizen.

In reality though, a Surface RT is not going to be your only machine. It absolutely shines as a Remote Desktop thin client – you can have Visual Studio running on your 12-core beast machine in the office and just remote in to use it. Flash is built into the browser, allowing stuff like Adobe Connect to work without a problem – the web browser version being much better than the iOS version, which still hasn’t been updated to support retina or iPhone 5 long displays. One thing you can’t do is share your screen with Adobe Connect. Full desktop-class Web Apps such as Google Docs work fine in Metro IE10 and without any browser chrome, could be mistaken for a “native” application.

Games from the Windows Store run quite badly on Surface. Jetpack Joyride has a pretty bad frame rate when lots of sprites are on the screen. Hopefully there is room for improvement in drivers, but don’t expect iPad 4 quality graphics. You cannot see pixels when sitting back and typing thanks to ClearType, but the resolution is nowhere near the iPad Retina display.

You might have a few favorite Windows applications that won’t run on Windows RT. I was worried that I would not be able to live without Windows Live Writer, but it turns out that Word has had a great blogging tool since version 2007, and it is even better with 2013.

Office 2013 RT

The first thing you should do with Surface is run Windows Update. This updates the Preview version of Office RT to the final version. Microsoft plan to deliver incremental functional updates, giving another reason to get a Microsoft Surface and not another Windows RT ARM device. Other manufacturers could cause delays to updates like Windows Phone 7 has been plagued with – carriers and device makers literally stopping you from using the latest version of the software running on your device (if MS do a Windows Phone 8, you should get it instead of any third party offering).

Office 2013 starts up very quickly. Saving to SkyDrive or the local drives just works. This really has full compatibility with Office files. The only glaring omission is Outlook – however, Exchange accounts are fully supported in the Mail application and Gmail works great in IE10.

Why I’m keeping it

I can actually do something productive with this device, unlike the iPad which has been reduced to a wife-pleasing YouTube machine. It has a great built in RDP client for when you need to use software that does not run on WinRT. It has a USB port which works with actual mice, USB drives and even my Kensington PowerPoint remote. If the space runs out, I can just insert a Micro SD card and expand the storage capacity. The Surface fills a useful void between an iPad and a MacBook Air – something that you can just throw in your bag without a laptop bag cover but can still get some work done on. Word, PowerPoint and Excel come free with Surface RT – these separately would be $30 or so on an iPad as iWork but here you get the real deal. I really am sick of lugging around proper laptops when I could just remote into a beefy machine under my desk. With LTE tethering in Japan, this is becoming a reality.

Only buy a Surface RT if you know what you are buying and can live without full legacy application support. As a thin client for real world web applications, it might make some people very happy indeed.

 

Working on an online MS Money replacement

I am finally fed up of having to install Microsoft Money and set up syncing of the data file, so I’ve decided to try and build a web based version. Mint.com does not support non-US markets and apparently does not even support adding your own transactions that have not been downloaded from a bank. “Private Money” is the codename and it looks a bit like this at the moment:

Capture

The stack:

  • ASP.NET MVC 3 as the application framework
  • Entity Framework 4.1 for ORM
  • NInject for a modular design with dependency injection
  • MigratorDotNet for database versioning with some tweaks to get it to work over different modules
  • jQuery and jQuery UI for some nice buttons, animations and AJAX loading. MVC 3 has great support for unobtrusive javascript with jQuery which is a dream to use.

I am planning on replicating the parts of MS Money that I use the most, mainly the transaction logging, reports and cashflow chart (which should be fun to make on a canvas element). Visually I am going for the Windows Live/Metro motif.

Thoughts on ASP.NET MVC3 Update and Entity Framework 4.1

Microsoft have now released an update to ASP.NET MVC3 imaginatively called “ASP.NET MVC3 Update”. This update upgrades NuGet, bundles Entity Framework 4.1 with all new templates, adds HTML5 template support and splits the jQuery libraries off into NuGet packages so they can be upgraded individually.

The bundling with new MVC projects is a sign that Microsoft has selected Entity Framework as the “chosen” ORM layer from now on. Linq2SQL is not flexible enough when dealing with pre-existing database schemas and third party solutions such NHibernate are difficult to get pointy-haired boss approval. EF 4.1 adds “code first” support where you define a very simple CLR object and it will automatically create the database tables for you. At first your eyes will light up thinking “finally! Rails’ ActiveRecord for .NET! Blessed by Microsoft!” until you find several missing pieces:

  • No migration support. The only option that EF provides when the “code first” objects behind your schema change (for instance, you add a new property) is to drop the entire database and start again. Rails has had this for years.
  • No code first support on real databases. That’s right, code first only works on SQL Compact file-based databases. This is fine for development but you can forget about just dropping the files onto a clients webserver and have it create your database for you.

There are a couple of ways around the limitations. I am having great success with a combination of MigratorDotNet and Entity Framework to provide an ActiveRecord style schema migration path. Hopefully I can write about this soon.

Windows .NET Development on Mac OSX

I use Windows at work so for some variety I have moved to a Mac at home. The 2010 Mac Mini is a decent little machine with the RAM upgraded to 4GB.

For Windows development you need Visual Studio, which means running Windows on your Mac. Bootcamp is one way of doing this, but then you lose all the benefits of OSX as your host OS. The secret is of course Parallels Desktop which allows you to run Windows virtualized on your Mac.

Using Parallels Desktop for Windows Development

It took a couple of tries to get this working decently.

  • Install Parallels Desktop
  • Get a Windows 7 32bit ISO image from MSDN (or a retail copy of course)
  • Set up a new Virtual Machine, specifying your Windows 7 ISO to install from

Screen shot 2010-12-16 at 9.19.16 PM.png

  • Select “Like a Mac” so the application integration gets automatically set up
  • IMPORTANT: For best performance, place the virtual machine on a separate drive. I get good results with an external USB2.0 Hard Drive but Mac Pro owners can put this on an internal disk. The built in hard disk of the Mac Mini is only 5400rpm which will be a real bottleneck when running OSX and Windows off the same disk. (You can of course use Parallels to run Windows off your Bootcamp partition – this will be slow too if the partition is on the same physical disk as OSX).
  • Allow Parallels to install Windows automatically. It will select the default settings during installation and input your product key. You will eventually end up with a nice Windows 7 desktop inside a Parallels window.

Screen shot 2010-12-16 at 9.27.33 PM.png

  • Parallels will automatically map your Desktop, Documents, Pictures, Music and Download folders to Windows’s equivalents, meaning you will see the same files on the Mac and Windows desktops.
  • Install Visual Studio 2010. You can mount the ISO in the Parallels Virtual Machine settings. A couple of restarts (of the VM) later and it is installed.
  • You will notice that running applications in the Windows VM show up in the Dock. You can even right click and pin the applications to the Dock. Parallels will start the virtual machine and launch the application.
  • Click the Coherence button in Parallels and Windows will be integrated with OSX. Launching Visual Studio 2010 from your pinned dock icon will give you Visual Studio 2010 with the same appearance and window behaviour as a standard Mac app:

Screen shot 2010-12-16 at 9.34.30 PM.png

  • You are now ready to develop Windows applications from OSX. Parallels has GPU acceleration so even WPF applications are not too bad.

Advanced Tips

  • Give the Windows 7 Virtual Machine enough RAM, but not enough that OSX will start paging. With 4GB of RAM, you can afford to give the VM 1GB. Remember: you are only going to run Visual Studio on Windows 7. All your other apps; browsers, Photoshop, Skype etc, will run in OSX.
  • Activate the “Pause Windows when no applications are open” setting under Applications in the Windows 7 VM settings. This means that the virtual machine will pause and give the memory back to OSX when no applications are running.
  • Be aware that your Documents folder on Windows is now a network drive, with all the security differences this brings. .NET will be strict about this in some cases (I hit this problem when running a custom content processor for XNA, which cannot be loaded from network drives) If you hit security problems, you need to set the \\.psf\ network drive to FullTrust for .NET. Run this command from a command prompt in Windows and restart Visual Studio:
C:\Windows\Microsoft.NET\Framework\v2.0.50727> CasPol.exe -pp off -m -ag 1.2 -url \\.psf\* FullTrust
  • Make sure that while you backup your Documents folder and Visual Studio projects with Time Machine, don’t backup the drive that the Windows Virtual Machine hard disk is on or you will run out of backup space very quickly. Parallels also has an option to make sure that this does not happen.

 

That upgraded WPF 4.0 Text rendering again

Just to hammer the point home about how important it is to upgrade to .NET 4.0 if you are using WPF, here are some comparison screenshots of the text rendering in WPF 3.5 and 4.0:

wpftext.png

Pay attention to the difference between the text rendering on lines 2 and 3.

Line 2 shows the new Display formatting mode available in WPF 4.0. This renders the text the same way as the rest of Windows – the shape of the font is distorted so that lines fall on pixel boundaries. For small text this should be used for consistency with the rest of Windows or users will most likely complain that your text looks “blurry” (even though it is technically rendered correctly). Large font sizes or high DPI screens can stick to the standard WPF rendering mode.

Line 3 shows what Japanese Windows XP users will see if they use your application as they don’t have Meiryo installed. In WPF 3.5, Asian text is a mess at small font sizes because WPF 3.5 does not support bitmap fonts – instead it scales down the large vector font data in the font file. WPF 4.0 supports bitmap fonts so that Japanese text now is rendered the same way as the rest of Japanese XP.

It is worth being reminded that it took Microsoft themselves to dogfood WPF 4.0 when developing Visual Studio 2010 before these problems were solved.

Evernote has no patience, drops WPF over fixed issues

Much noise has been made about Evernote’s new Windows client. For version 4, they dropped WPF/.NET and released a C++ native application.

They were pretty damning with their reasoning:

Evernote 4 is a major departure from Evernote 3.5 in every way. While 3.5 added tons of great new features, there were some problems we simply couldn’t fix: the blurry fonts, slow startup times, large memory footprint, and poor support for certain graphics cards were all issues that the technology behind 3.5 (Windows .net and WPF) was incapable of resolving. As a result, we ended up chasing down platform bugs rather than adding the great features our users wanted.

So we decided to start over from scratch, with fast, native C++ that we knew we could rely on. As you’ll see, the results are amazing. This new version will set a foundation for rapid improvement.

Evernote 4 is designed to give you a great experience on any computer that you use, whether you’re on a netbook, a five year old Windows XP machine or a super fast top-of-the-line Windows 7 computer.

On our test hardware, Evernote 4 starts five times faster, and uses half the memory of Evernote 3.5.

 

You cannot make statements like “issues that the technology behind 3.5 … was incapable of resolving” without providing more information on the problems they faced and the solutions they tried. For all we know, their Windows client development team could have tripled in size to get the native version out the door.

Evernote 3.5 was a textbook example of reasons to immediately upgrade to .NET 4.0 if you are building WPF applications. Visual Studio’s UI layer is now in WPF, presumably after fixing all these issues.

“The text is blurry”

This is fixed in WPF 4.0, which can render text almost exactly as Windows does if developers request it. The standard behaviour is a DPI-independent accurate representation of the font on the screen (the same way OSX renders text and also the reason why text is “blurry” on Macs).

This is a one-line fix in .NET 4.0, just apply TextOptions.TextFormattingMode=”Display” to your root XAML element. Asian text will also now use bitmap fonts so customers on Japanese XP machines will now get consistent text rendering between your app and their vintage OS (of course Vista/Win7 should be using Meiryo).

“The download size is too large”

The runtime for .NET 3.5 is 65MB or so. .NET 4.0 has reduced this to a 28MB download. Ironically, the Evernote 4.0 installer is 40MB – most likely larger than bundling the .NET 4.0 runtime in the installer of 3.5. Users with .NET 4.0 already installed would have got an even smaller download as the installer would not download the runtime.

Evernote 4.0 appears to include Chromium (the Chrome web browser base), Foxit Reader’s PDF libraries, SQLLite and libxml which could be replaced with the built in Web Browser control, XPS rendering, SQLCE and built in XML libraries of .NET 4.0.

“It uses too much memory”

If your application has hundreds of threads and handles complex local operations, it will require memory. Evernote’s statement about version 4.0 using “half” the memory of the managed 3.5 version is pretty damning considering that the application is not very complicated.

While you may never be able to match the memory consumption of a “native” application in .NET, there are some things you need to know to improve your memory use:

  • Use .NET 4.0 as it has background garbage collection
  • Keep your visual tree small (no endless nested Grids in XAML)
  • Virtualize your ItemControls! This might be the most important issue. You cannot bind a XAML WrapPanel to 1000 images without Virtualization and expect scrolling to be smooth or your memory consumption to be low.
  • Use the ThreadPool and Background Workers instead of manually creating threads. ThreadPool-based tasks intelligently carry out the number of simultaneous tasks based on the number of processor cores you have. Allowing your code to create and infinite number of threads is a recipe for disaster as each thread needs its own stack space of at least 1MB. Ideally use .NET 4.0s new parallel programming and async functions.
  • Read the correct memory numbers in Task Manager (Private Working Set).

“The application is slow to start up”

Managed applications do not have to start slowly. A new application from a VS template will start up instantly – it is when you start adding references to other libraries, interop hooks and modules (for composite apps) that startup time starts dropping. Perhaps the most important thing to do is use NGEN to generate a native version of your application at install time, instead of waiting for the JIT compilation when the user launches the application. The application will slow down when loading modules for the first time if they have not been pre-compiled. There is some great information on improving start up times on MSDN, as usual.

In general, try to show some part of your application immediately. A splash screen might be okay for application start up times of less than a few seconds, but there is no reason why the main window can not be displayed and relevent data start loading in the background. This is mainly a perception issue. If you only show your main window after loading all data that your application could possibly need ever, of course start up will appear to be slow.

Did Evernote even try .NET 4.0?

The .NET development community is waiting for some sort of postmortem from the Evernote team. Most of the above problems would have been solved by upgrading to .NET 4.0 and running some decent profilers on the executable.

Rewriting your application natively will no doubt use less memory and start up faster, but it will also look worse, take longer, be more expensive to develop and your UI will break when high DPI screens start to be used. Portability is not a reason: if you want an application to work on Windows/Mac/Linux/iOS/Android, you write a web application.

If you want an example of an amazing WPF 4.0 application designed for the Windows platform, check out MetroTwit.