P3.NET

Environmental Config Transforms, Part 1

Configuration file transforms have been around for quite a while and most companies use them to generate different config files for each environment but Visual Studio does not really support the functionality most companies need.In this article I’m going to talk about why the existing Visual Studio implementation is flawed and how to fix it so that you can have true environmental transforms that are actually useful.

For purposes of this article we will assume a simple web application (although it applies to any application) that will be deployed to 2 different environments – test and production. We will also assume that developers debug the application on their local machine and therefore should not have to do any special tasks to debug the application locally. As such we’ll have a 3th, default, environment – debug.

Read More

Hosting a Private Visual Studio Gallery

Visual Studio extensions are really popular these days. Not surprisingly Visual Studio has a very active extensions gallery. But unfortunately the gallery is public so if you develop some extensions for your personal use, or for your company, then you cannot use the public gallery. Fortunately though VS supports the concept of a private gallery. A private gallery is nothing more than an extension gallery that is not accessible to the world. It is discussed on MSDN so refer to there for more information about the what’s and why’s. Unfortunately the documentation is a little vague and setting one up is not trivial. I’m going to discuss the steps needed to get a private gallery up and running.

Read More

Setting Up a Private NuGet Repository

These days most developers use NuGet to reference third-party dependencies like EntityFramework, Enterprise Library and NInject. A full discussion of NuGet is beyond this post. There are lots of articles on what it is, how to use it and how to package and publish to it so I’ll ignore all these things. But what about internal dependencies like shared libraries used by company applications? It turns out you can host your own private NuGet repository as well. Visual Studio is already set up to support this. The hard part is getting the repository set up. At my company we’ve been running a local NuGet repository for a year and it works great, for the most part. We have a company policy that all dependencies must be stored in NuGet. This pretty much eliminates versioning issues, sharing code across projects and storing binaries in source control. In this post I’m going to go over the steps to set up a private NuGet repository. Others have posted on this topic and there is some documentation available but unfortunately it is out of date.

Read More

(Free) WinForms/WPF is Dead in VS2012 Express

UPDATE: Great news!!! Microsoft has seen the error of their ways. They have formally announced that they will in fact release VS2012 Express for desktop apps (instead of just Metro)- http://blogs.msdn.com/b/visualstudio/archive/2012/06/08/visual-studio-express-2012-for-windows-desktop.aspx.  This is a big win for students and hobbyists.

Well VS2012 is finally in RC mode. I have to say the UI is looking better but please, for the love of all that use VS every day, GET RID OF THE STUPID ALL CAPS MENUS!!!!! Who in the world is designing this stuff in Redmond? It’s like they never took UI design 101 classes. Everybody who has used a computer for more than 5 minutes knows where the menus are so why do they have to be highlighted? It couuld just be me but it seems like the management at MS are making more and more missteps with this release as we get closer.  Now on to the really, really disasterous news for VS2012…

Read More

Visual Studio 11 Beta – First Glance

Now that the beta is out I’ve been working with it a week and I can provide some feedback on the things I do and don’t like. To organize things a little better I’ll identify some of the new features that were added and give my opinion about the usefulness. All this is strictly my opinion so take from it what you would like.

Read More

Windows 8 and Visual Studio 11 Look…meh

Am I the only one that is not that excited about Win8?  I haven’t had time yet to play around with it (waiting for VMWare to upgrade me to Workstation 8) so I might be missing something but I’m just not seeing anything worth looking at.  Let me elaborate.  Firstly note that I always like to stay with the latest stuff so Win8 and VS11 will be on my machine as soon as they are released.  I’m more interested in the general public’s interest in the products.

OS History

First there was XP (ignoring anything prior to that) which is a decade old and still popular.  It doesn’t have any of the bells and whistles of modern OSes but it is solid and heavily used.  Many companies still have no intention of upgrading from XP.  MS even extended the support cycle longer than normal to give people time.

Vista came out and lasted a year.  It was a horrible disappointment in most areas but it introduced some radical UI changes that are popular.  Jumplists, task dialog, restart manager, etc.  Unforunately nobody wanted to upgrade so applications that want to use these new features either can’t or have to write bridge code to hide the differences.  If you’ve ever written such bridge code you’ll realize that MS should have done it before release.  Even worse is that .NET (which MS said is their platform of choice going forward) doesn’t even support most of the new UI stuff.  Instead MS released a code pack that adds in the functionality that should be in the framework.  Still worse is that you can’t even use that code unless you’re running under Vista+ because it’ll blow up.  The code pack was the perfect opportunity to write the bridge code once so we didn’t have to but alas no. 

Quickly on the heels of Vista is Win7, the current OS.  Win7 didn’t have any radical changes but it did fix the issues with Vista.  Win7 is, overall, a success and generally recommended as a required upgrade.  Companies are moving to it as they get new computers but there is certainly no big rush.  Win7 is the spiritual successor to XP and worth the effort.  With Win7 came VS2010 and .NET v4.  Alas still no support for the Vista+ features.  So MS wants us writing Win7 apps but we can’t because: a) XP is still popular, b) there is no bridge code to hide the details and c) none of the new features are in .NET anyway.  So while Win7 is nice, we’re still using the XP subset.

 Windows 8

Here’s where things get really frustrating.  Win8 doesn’t offer anything that anybody has been asking for as far as I can tell.  MS is pushing the Windows Phone 7 (WP7) UI with tiles and touchscreens (touch).  How many people are using touch today?  How many people are even talking about buying touch?  I know no one.  There simply isn’t a demand for them on the desktop yet.  Why would there be?  Unlike a phone or similar device we have a mouse that gives us everything we need.  Yes touch may one day become a commonplace item but not today.  Certainly MS should add support for touch in Windows but it shouldn’t be at the cost of deprecating everything else.  Touch works well for small lists of items but as you add more it gets harder to work with.  Have you ever tried using touch for a list of states?  It takes a while to get to the bottom.  That’s why scrollbars were invented.  I think it is a bad idea for MS to build the Win8 UI around touch and tiles.  There simply isn’t a demand or support for this technology yet.

Win8 is also introducing a brand new application type – Metro.  When I think of metro I think of the various subway systems I’ve ridden.  How awful they are.  How dirty.  Where does MS come up with these names?  But I digress – Metro is a new way of developing apps that (seems) to forgo existing technologies in lieu of HTML5 and XAML.  Potentially a good idea but let’s look at what is wrong with this approach. 

Firstly only Win8 supports Metro.  Therefore if you want to build your app using Metro you have to build 2 – one for Win8 and one for everybody else.  Since Metro looks so vastly different I don’t know how much code sharing is possible at this point.  It’s like telling developers that they need WPF for Win7 and WinForms for everybody else.  What developer in their right mind would do that?  Developers will just stick with the universal application until everybody gets upgraded.  So I think Metro, while highly touted by MS, is going to see little commercial success until post-Win8.

Secondly MS has been pushing SL and WPF for several years now.  Suddenly they’re saying these technologies are deprecated in lieu of Metro.  Really?  Why should I learn yet another technology when it can be deprecated itself in a handful of years?  One of the things that is important for developer buy in is longevity of the technology.  Yes technology needs to evolve but to effectively pull the switch on one set while pushing another just seems wrong.

Will Metro be all that MS is hyping it up to be?  Will developers jump on the bandwagon?  Will we really have to learn a whole new set of technology just to be Win8-friendly?  We’ll know as Win8 gets closer but right now it certainly seems like a very risky bet on MS’es part.

Overall I currently see Win8 as an upgrade only if you are running XP, buy a new machine or just want to be on the leading edge.  There is nothing that has been announced that even remotely sounds interesting as a consumer.  On the developer front I’m not going to be writing Metro apps because I need to support non-Win8 as well.  Maybe when Win.Next.Next comes out and everybody is running Win8 I’ll look into it but not until then.  I think pushing Metro and touchscreen is just going to alienate more people, both developers and consumers.  WPF and related technologies aren’t going away just because MS might want them to.

Visual Studio 11

Here’s where things get more interesting.  VS11 will have a lot of cool new features.  .NET v4.5 is introducing some really nice new features for parallel development and ASP.NET.  WPF, WCF and WinForms are not really getting any major enhancements that I see.  VS11 itself though will be a recommended upgrade.  Here’s a few of the high points for me.

  • Project Compatibility – This is a major feature and I’m glad it was finally announced.  It will allow teams to upgrade piecemeal rather than requiring everyone to upgrade at once.  The only cost is that the solution/project must already be in VS2010 SP1.  Still it’ll be nice to have mixed teams.  I’m curious to know how it’ll impact replication of bugs and whatnot though.  Time will tell.
  • Model Binding – MVC already has this feature so it is nice to see it in ASP.NET.  Model binding will greatly reduce the likelihood of bad binding causing runtime errors while making development easier.  Intellisense enhancements are also nice.
  • Solution Navigator – I’m really not a big fan of this but a lot of people are.  The ability to browse code from Solution Explorer will certainly make some windows like ClassView obsolete.
  • Find and replace with regular expressions – It is about time.  I never used the FR regular expression search because it used a bizarre syntax.  Now that it uses the .NET implementation it’ll make finding things easier.
  • Find window – Available in VS2010 today with the appropriate extras installed, this is actually pretty handy.  It makes finding things easier.  Once it is integrated into VS11 it’ll be better.
  • C++/CLI Intellisense – C++/CLI folks have been screaming for it for years.  It’s finally hear.  Hopefully C++/CLI isn’t needed too much anymore but it’s nice to have when you need it.
  • Async – For VB and C# the addition of async will mean we have to write less anonymous methods and/or functions to accomplish the same thing.  This alone is worth the price.
  • Standalone Intellitrace – In VS2010 (from what I can remember) you had to do a lot of work to get IT running on a machine without VS.  You might have had to even install VS, I can’t remember.  In VS11 you’ll be able to drop IT on a machine that is having problems and then view the log on your dev machine.  This will make IT far more useful.
  • LocalDB – SQL Express is dead.  Long live LocalDB.  Finally a dev version of SQL that doesn’t require all the extras of SQLX while still giving us the same features.  Unfortunately I think this may impact project compatibility with VS2010 so beware.
  • IIS Express – WebDev is dead.  Long live IISX.  Actually IISX has been out for a while and available as an option in VS2010 SP1 but it’ll now be integrated into VS11.  All the features of IIS without the overhead.

So, in summary, I think Win8 is going to be the next Windows Millenium Edition.  It’s going to be a lackluster releas from the consumer’s point of few.  At this point it doesn’t seem to have any features that anybody is going to care about and yet a lot of emphasis is being given to Win8-specific functionality.  I don’t think there is going to be a great migration to Win8 except for new computers.  VS11 on the other hand is going to be a recommended update but just for its new features and .NET v4.5.  Maybe MS can get the Win7 features that are missing in .NET into v4.5 but I won’t hold my breathe.  Instead we’ll be stuck with a couple of Win8-specific features that nobody will use for the foreseeable future.  As both releases get closer we’ll get a better idea of what impact they’ll have but this is my opinion for now.

BuildVer Update

UPDATE: A new update (v2.1) that resolves a few issues:

  • Character set conflicts when using non-ASCII characters
  • Updated documentation on how to integrate version.rci without having VS delete it the next time you open the resource designer
  • Fix for parameters that are built from the product version

I recently had the need to update my BuildVer tool to use in newer projects.  BuildVer is an incremental versioning tool that can be used for automated builds.  It was originally written to allow us to use the Win32 VERSIONINFO resource but have it updated for each build.  Later functionality was added to support generating standard .NET assembly info files.  While the existing tool was sufficient I decided that it was time to update the code and, at the same time, add some new features.

The original code was written over a decade ago in C++.  Later it was updated for .NET support and to use MFC types.  The new tool is completely written in C#.  The original version could generate 1 or 2 files (a managed and unmanaged file) and an optional text file.  Some support was added for specifying the build information on the command line.  This was sufficient to meet the needs of the time.

v2 supports generating any number of output files with their corresponding template files.  The tool works with any text file.  Additionally the configuration file has been expanded to allow for specifying arbitrary parameter name-value sets that can be used in template files.  There are a couple of pre-defined sets for versioning, company information, etc.  Any of the parameter values can be overridden by the command line.  This allows for more flexibility in the tool while keeping the command line options concise.

The readme.txt file contains all the details.  The attached file contains the source code and a v4 version of the tool along with sample templates for C# and C++.  Feel free to use the tool as you see fit.  One note however, some of the code in the tool (specifically the command line processor) is copyright Carlson Engineering, Inc. and may not be reused without explicit permission.  You can compile and use the tool itself without permission. 

VS 2010 SP1 Favorite Changes

Honestly SP1 doesn’t seem to be a major release compared to previous SPs we’ve seen but there are still some interesting changes.  Here’s my highlights.

  • Non-browser based help –  If there is absolutely one feature that caused an uproar during the betas of VS 2010 it was the new help system.  The help team took a serious beating while trying to justify the new system.  For better or worse we have to live with the results.  One of the big friction points was the reliance on the web browser and online help.  Fortunately before final release MS fixed things so we could have offline help but we were stuck with the browser.  Fortunately the group at Helpware Group remedied this with a client UI for viewing help files.  Albeit it wasn’t the best tool and it seems like a new fix was available weely but the group really did a great job and they stayed vigilent. 

    Fortunately with the release of SP1 they no longer have to do this as MS has included a client UI for viewing help files.  Hopefully MS has learned a valuable lesson about developers and their help system and, in the future, will not make such sweeping changes without first getting feedback.

  • Silverlight 4 –  Sure you could download the SDK separately but now it is included. 
  • Docking window crash – How long has VS supported docking windows?  How long has multiple monitor support been around?  Evidently nobody at MS does any of this because the RTM version of VS2010 crashes if you dock/undock windows while debugging.  Fortunately MS fixed this with a hotfix and now it is available in SP1.
  • IIS Express – What, never heard of IIS Express?  It is basically IIS bundled by itself and usable on client machines without all the headaches and issues of IIS.  Read about it here.  SP1 introduces support for IIS Express.  I suspect that most devs will migrate to it and that WebDevServer will quickly go away given all its existing limitations.
  • x64 Intellitrace support-  SP1 now supports using Intellitrace in x64 builds.  Note that this doesn’t mean you can do Edit and Continue in x64.  That issue still remains but at least x64 is starting to get the love.

UPDATE:  A couple of notes.

  1. SP1 can be installed over SP1 beta.
  2. Remember how long it took to install VS 2008 SP1.  Plan for the same hour or so.  This time it just takes that long to install rather than taking 20 minutes to extract the files like it did in VS 2008.