Scott Hanselman

Putting (my VB6) Windows Apps in the Windows 10 Store - Project Centennial

September 14, '16 Comments [35] Posted in VB | Win10
Sponsored By

Evernote in the Windows 10 Store with Project CentennialI noticed today that Evernote was in the Windows Store. I went to the store, installed Evernote, and it ran. No nextnextnextfinish-style install, it just worked and it worked nicely. It's a Win32 app and it appears to use NodeWebKit for part of it's UI. But it's a Windows app, just like VB6 apps and just like .NET apps and just like UWP (Universal Windows Platform) apps, so I found this to be pretty cool. Now that the Evernote app is a store app it can use Windows 10 specific features like Live Tiles and Notifications and it'll be always up to date.

The Windows Store is starting (slowly) to roll out and include existing desktop apps and games by building and packaging those apps using the Universal Windows Platform. This was called "Project Centennial" when they announced it at the BUILD conference. It lets you basically put any Windows App in the Windows Store, which is cool. Apps that live there are safe, won't mess up your machine, and are quickly installed and uninstalled.

Here's some of the details about what's happening with your app behind the scenes, from this article. This is one of the main benefits of the Windows Store. Apps from the Store can't mess up your system on a global scale.

[The app] runs in a special environment where any accesses that the app makes to the file system and to the Registry are redirected. The file named Registry.dat is used for Registry redirection. It's actually a Registry hive, so you can view it in the Windows Registry Editor (Regedit). When it comes to the file system, the only thing redirected is the AppData folder, and it is redirected to the same location that app data is stored for all UWP apps. This location is known as the local app data store, and you access it by using the ApplicationData.LocalFolderproperty. This way, your code is already ported to read and write app data in the correct place without you doing anything. And you can also write there directly. One benefit of file system redirection is a cleaner uninstall experience.

The "DesktopAppConverter" is now packaged in the Windows Store as well, even though it runs at the command prompt! If your Windows Desktop app has a "silent installer" then you can run this DesktopAppConvertor on your installer to make an APPX package that you can then theoretically upload to the Store.

NOTE: This "Centennial" technology is in Windows 10 AU, so if you haven't auto-updated yet, you can get AU now.

They are also working with install vendors like InstallShield and WiX to so their installation creation apps will create Windows Store apps with the Desktop Bridge automatically. This way your existing MSIs and stuff can turn into UWP packages and live in the store.


It looks like there are a few ways to make your existing Windows apps into Windows 10 Store-ready apps. You can use this DesktopAppConverter and run it in your existing  silent installer. Once you've made your app a Store App, you can "light up" your app with Live Tiles and Notifications and  other features with code. Check out the GitHub Repro with samples that show you how to add Tiles or Background tasks. You can use [Conditional("DesktopUWP")] compilation if you have both a Windows Store and Windows desktop version of your app with a traditional installer.

If your app is a simple Xcopy-deploy app that has no installer, it's even easier. To prove this I installed Visual Basic 6 on my Windows 10 machine. OH YES I DID.

NOTE: I am using VB6 as a fun but also very cool example. VB6 is long out of support but apps created with it still run great on Windows because they are win32 apps. For me, this means that if I had a VB6 app that I wanted to move into the Store and widen my audience, I could.

I made a quick little Project1.exe in VB6 that runs on its own.

Visual Basic 6 on Windows 10

I made an AppxManifest.xml with these contents following this HelloWorld sample.

<?xml version="1.0" encoding="utf-8"?>
<Identity Name="HanselmanVB6"
Version="" />
<DisplayName>Scott Hanselman uses VB6</DisplayName>
<Description>I wish there was a description entered</Description>
<Resource Language="en-us" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14316.0" MaxVersionTested="10.0.14316.0" />
<rescap:Capability Name="runFullTrust"/>
<Application Id="HanselmanVB6" Executable="Project1.exe" EntryPoint="Windows.FullTrustApplication">
DisplayName="Hey it's VB6"
Description="Hey it's VB6" />

In the folder is my Project1.exe long with an Assets folder with my logo and a few PNGs.

Now I can run the DesktopAppConverter if I have a quiet installer, but since I've just got a small xcopyable app, I'll run this to test on my local machine.

Add-AppxPackage -register .\AppxManifest.xml

And now my little VB6 app is installed locally and in my Start Menu.

VB6 as a Windows App

When I am ready to get my app ready for production and submission to the Store I'll follow the guidance and docs here and use Visual Studio, or just do the work manually at the command line with the MakeAppx and SignTool utilities.

"C:\Program Files (x86)\Windows Kits\10\bin\x86\makeappx" pack /d . /p Project1.appx

Later I'll buy a code signing cert, but for now I'll make a fake local one, trust it, and make a pfx cert.

"C:\Program Files (x86)\Windows Kits\10\bin\x86\makecert" /n "CN=HanselmanVB6" /r /pe /h /0 /eku "," /e 12/31/2016 /sv MyLocalKey1.pvk MyLocalKey1.cer
"C:\Program Files (x86)\Windows Kits\10\bin\x86\pvk2pfx" -po -pvk MyLocalKey1.pvk -spc MyLocalKey1.cer -pfx MyLocalKey1.pfx
certutil -user -addstore Root MyLocalKey1.cer

Now I'll sign my Appx.

NOTE: Make sure the Identity in the AppxManifest matches the code signing cert's CN=Identity. That's the FULL string from the cert. Otherwise you'll see weird stuff in your Event Viewer in Microsoft|Windows\AppxPackagingOM|Microsoft-Windows-AppxPackaging/Operational like "error 0x8007000B: The app manifest publisher name (CN=HanselmanVB6, O=Hanselman, L=Portland, S=OR, C=USA) must match the subject name of the signing certificate exactly (CN=HanselmanVB6)."

I'll use a command line like this. Remember that Visual Studio can hide a lot of this, but since I'm doing it manually it's good to understand the details.

"C:\Program Files (x86)\Windows Kits\10\bin\x86\signtool.exe" sign /debug /fd SHA256 /a /f MyLocalKey1.pfx Project1.appx

The following certificates were considered:
Issued to: HanselmanVB6
Issued by: HanselmanVB6
Expires: Sat Dec 31 00:00:00 2016
SHA1 hash: 19F384D1D0BD33F107B2D7344C4CA40F2A557749

After EKU filter, 1 certs were left.
After expiry filter, 1 certs were left.
After Private Key filter, 1 certs were left.
The following certificate was selected:
Issued to: HanselmanVB6
Issued by: HanselmanVB6
Expires: Sat Dec 31 00:00:00 2016
SHA1 hash: 19F384D1D0BD33F107B2D7344C4CA40F2A557749

The following additional certificates will be attached:
Done Adding Additional Store
Successfully signed: Project1.appx

Number of files successfully Signed: 1
Number of warnings: 0
Number of errors: 0

Now I've got a (local developer) signed, packaged Appx that has a VB6 app inside it. If I double click I'll get the Appx installer, but what I really want to do is sign it with a real cert and put it in the Windows Store!

VB6 in the Windows Store

Here's the app running. Pretty amazing UX, I know.

VB6 app as a Windows Store App

It's early days, IMHO, but I'm looking forward to a time when I can go to the Windows Store and get my favorite apps like Windows Open Live Writer, Office, Slack, and more! Now's the time for you to start exploring these tools.

Related Links

Sponsor: Big thanks to Redgate for sponsoring the feed this week. Discover the world’s most trusted SQL Server comparison tool. Enjoy a free trial of SQL Compare, the industry standard for comparing and deploying SQL Server schemas.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Visual Studio Explosion! - VS2010 SP1 *BETA* Released and Context

December 10, '10 Comments [33] Posted in ASP.NET | ASP.NET MVC | Bugs | IIS | Microsoft | MSDN | VB | VS2010
Sponsored By

Link to VS2010 Wallpapers Site It's a holiday miracle! OK, maybe not a miracle, but folks have been working hard on Visual Studio 2010 Service Pack 1. The BETA was released today. See how BETA is in RED? That's because it's a beta.

Funny thing about beta service packs. They are Service Packs so there are lots of good bug fixes. But it's beta, which means we, Dear Reader, are not sure if they've missed some.

It's beta software, so be careful. Back things up, maybe take a disk image.

There is a go-live license, which means you can use this software today and use it in production. Upgrading from SP1 Beta to SP1 "final" will be one step.

If you hate betas, feel overwhelmed, don't like being on the cutting edge and don't want obscure details, stop reading now and go here.

Download Links:

Here's the curent Visual Studio 2010 SP1 Beta README file.

Beta Caveats (That's a fancy word for "Warning")

Be aware that Microsoft is in the middle of a lot of Beta Releases. It's your choice to play now or wait.

First, MOST of this beta stuff works together just fine. You may have seen my PDC talk where I used all of this together to build an application.

For example, all this works together today:

  • VS 2010 SP1 Beta
  • ASP.NET MVC 3 RC2 (releasing VERY VERY SOON - install it over the top to maintain Razor IntelliSense)
  • Razor Tooling
  • SQL Compact Edition 4 Beta
  • Entity Framework 4 Code First (CTP5)

There may be some bugs, so If you need things to not break at all, then just wait a month or two for all this Beta to calm down. For example, the new "Async CTP" isn't compatible with the web tooling.

Some folks have asked, "When will the beta releases be over and I can start working with final code?"

ASP.NET MVC 3, WebMatrix, IIS Express, SQL Compact Edition 4 and more will all be released in mid-January. Visual Studio 2010 Service Pack 1 will finalize a few months later. Use VS2010 today and come spring you'll have some new improvements that will build on VS2010 and make coding more enjoyable. They'll all work together.

That said, if you have a little patience, I encourage you to check out Visual Studio 2010 SP1 Beta. There's LOTS of great fixes, updated features and new tooling. Here's a sense of what's updated. We'll get a more complete (meaning "official") list nearer to release. This list isn't complete. I'm working on getting a complete list.

What's in Visual Studio 2010 SP1 BETA

In addition to fixes for bugs and things reported via Microsoft Connect, there's also these updates to Visual Studio 2010.

Web Bug Fixes

Just over 100 bug fixes related to web development, including fixes for JavaScript/CSS/HTML editors, crash bugs, design view bugs, and Visual Web Developer bugs.

HTML5 Schema Support

We’ve added *initial* support for HTML5 to the HTML editor so you can get IntelliSense and validation for HTML5 elements and attributes (choose HTML or XHTML5 from the schema drop-down). Includes support for popular new elements, e.g. video, audio, section, header, etc., and data-* attributes. The implementation is not complete and we are continuing to work on providing a great HTML5 experience for a future version of Visual Studio. There are *no* IntelliSense updates for HTML5 JavaScript APIs, e.g. Canvas, Cross-document Messaging, DOM Storage, etc.

IIS Express Support

Support for IIS Express as a local hosting option for Web Sites and Web Application Projects, including the option to set it as the default for new projects. No need to be an administrator to use IIS Express, including creating new sites from within Visual Studio. IIS Express supports:

  • SSL
  • Classic & Integrated pipeline modes
  • Basic & Windows authentication
  • Edit & Continue in debug
  • Creating new virtual directories when using IIS or IIS Express in Web Sites

Here's IIS Express appearing in a dialog choosing where a new Web Application should be:

IIS Express

Project Properties has been updated. Note the choices for IIS Express, Visual Studio Development Server, etc.

IIS Express

Here we're able to add a New Virtual Directory from within Visual Studio.


Note, SP1 does *not* include IIS Express, you need to download and install it separately. IIS 7.5 Express Beta 3 can be installed using Web PI 3.0 via the UX or directly via this direct link. Note that you don't need WebMatrix to get IIS Express now (win!).

IIS Express Beta 3

SQL Compact Edition 4 Tooling

I've blogged about EF Code First ("Entity Framework Magic Unicorn") before, which released a CTP5 today. I've also talked about SQL Compact Edition 4, a tiny xcopyable file based SQL Server. I showed them all working together in my PDC talk PDC10: Building a Blog with Microsoft "Unnamed Package of Web Love"

In that talk, I was able to open SQL Compact Edition 4 database files directly in Visual Studio. Internally we call that "SQL Compact Edition Tooling." Microsoft folks often refer to the Runtime and the Tooling separately.

Here's the SQL Compact Edition 4 Tools for VS2010 SP1 Beta that I used in my PDC talk. Additionally Web Deploy v2 is coming, and will allow you to easily migrate SQL Compact 4 to SQL Server directly when you outgrow the former. You can install both of them directly from the Web Platform Installer 3.0.

Go here to install Web PI 3, shut it down, then run it again from the Start Menu and select the things you want.

Additional Good Stuff

  • Silverlight 4 Tools for Visual Studio 2010 plus RIA Services is now included in the box along with Silverlight 3 support.
  • Unit Testing on .NET 3.5 – Today all unit tests are run under .NET 4. While acceptable for most users because of the compatibility done in .NET 4, this caused problems for some of you with .NET 3.5-specific dependencies.
  • IntelliTrace F5 for 64 bit and SharePoint projects – This is awesome for me as I needed IntelliTrace on x64 literally yesterday.
  • Performance Wizard for Silverlight – Now you can use the profiling tools on Silverlight apps as well.
  • VB Compiler runtime switch – This switch will enable Visual Basic developers to target their apps and libraries at platforms where the full VB Runtime hasn’t traditionally been available. Should be a win for VB on phone, XNA, etc.

Some Choice Bug Fixes (my choice)

  • The XAML editor respects control visibility
  • Offline Helper View with Index (is back)
  • IntelliTrace with F5 on Sharepoint Projects
  • More C++ MFC support for Windows 7 shiny things
  • Silverlight startup performance improvments

Simple Conclusion in Context

  • Keep using Visual Studio 2010 and feel no pressure to install a beta anything. There's lots of great stuff in VS2010 to explore.
  • If you install VS2010 SP1 beta, don't uninstall it if you can avoid it. Rather, wait for SP1 final which will upgrade your beta cleanly and leave you in the best state.
  • If you want to see the update wave of Web Tools and get some beta bug fixes, install the SP1 Beta and report bugs. If you're using SQL Compact, check out their tools as well.
  • If you aren't installing the beta tools today, then relax, and install the final web tools stuff in the January then VS2010 SP1 later in spring.
  • When it's all released, you'll be able to install all this as one package from Web Platform Installer. You'll run Web PI, select Visual Studio 2010 SP1, then install.

Related Links


About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

The Weekly Source Code 56 - Visual Studio 2010 and .NET Framework 4 Training Kit - Code Contracts, Parallel Framework and COM Interop

August 12, '10 Comments [11] Posted in ASP.NET | ASP.NET Ajax | ASP.NET Dynamic Data | ASP.NET MVC | BCL | Learning .NET | LINQ | OData | Open Source | Programming | Source Code | VB | Web Services | Win7 | Windows Client | WPF
Sponsored By

Do you like a big pile of source code? Well, there is an imperial buttload of source in the Visual Studio 2010 and .NET Framework 4 Training Kit. It's actually a 178 meg download, which is insane. Perhaps start your download now and get it in the morning when you get up. It's extremely well put together and I say Kudos to the folks that did it. They are better people than I.

I like to explore it while watching TV myself and found myself looking through tonight. I checked my blog and while I thought I'd shared this with you before, Dear Reader, I hadn't. My bad, because it's pure gold. With C# and VB, natch.

Here's an outline of what's inside. I've heard of folks setting up lunch-time study groups and going through each section.

C# 4 Visual Basic 10 
F# Parallel Extensions
Windows Communication Foundation Windows Workflow
Windows Presentation Foundation ASP.NET 4
Windows 7 Entity Framework
ADO.NET Data Services (OData) Managed Extensibility Framework
Visual Studio Team System RIA Services
Office Development  

I love using this kit in my talks, and used it a lot in my Lap Around .NET 4 talk.

There's Labs, Presentations, Demos, Labs and links to online Videos. It'll walk you step by step through loads of content and is a great starter if you're getting into what's new in .NET 4.

Here's a few of my favorite bits, and they aren't the parts you hear the marketing folks gabbing about.

Code Contracts

Remember the old coding adage to "Assert Your Expectations?" Well, sometimes Debug.Assert is either inappropriate or cumbersome and what you really need is a method contract. Methods have names and parameters, and those are contracts. Now they can have conditions like "don't even bother calling this method unless userId is greater than or equal to 0 and make sure the result isn't null!

Code Contracts continues to be revised, with a new version out just last month for both 2008 and 2010. The core types that you need are included in mscorlib with .NET 4.0, but you do need to download the tools to see them inside Visual Studio. If you have VS Pro, you'll get runtime checking and VS Ultimate gets that plus static checking. If I have static checking and the tools I'll see a nice new tab in Project Properties:

Code Contracts Properties Tab in Visual Studio

I can even get Blue Squigglies for Contract Violations as seen below.

A blue squigglie showing that a contract isn't satisfied

As a nice coincidence, you can go and download Chapter 15 of Jon Skeet's C# in Depth for free which happens to be on Code Contracts.

Here's a basic idea of what it looks like. If you have static analysis, you'll get squiggles on the lines I've highlighted as they are points where the Contract isn't being fulfilled. Otherwise you'll get a runtime ContractException. Code Contracts are a great tool when used in conjunction with Test Driven Development.

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics.Contracts;

namespace ContractsDemo
class Program
static void Main(string[] args)
var password = GetPassword(-1);

#region Header
/// <param name="userId">Should be greater than 0</param>
/// <returns>non-null string</returns>
static string GetPassword(int userId)
Contract.Requires(userId >= 0, "UserId must be");
Contract.Ensures(Contract.Result<string>() != null);

if (userId == 0)
// Made some code to log behavior

// User doesn't exist
return null;
else if (userId > 0)
return "Password";

return null;

COM Interop sucks WAY less in .NET 4

I did a lot of COM Interop back in the day and it sucked. It wasn't fun and you always felt when you were leaving managed code and entering COM. You'd have to use Primary Interop Assemblies or PIAs and they were, well, PIAs. I talked about this a little bit last year in Beta 1, but it changed and got simpler in .NET 4 release.

Here's a nice little sample I use from the kit that gets the Processes on your system and then makes a list with LINQ of the big ones, makes a chart in Excel, then pastes the chart into Word.

If you've used Office Automation from managed code before, notice that you can say Range[] now, and not get_range(). You can call COM methods like ChartWizard with named parameters, and without including Type.Missing fifteen times. As an aside, notice also the default parameter value on the method.

static void GenerateChart(bool copyToWord = false)
var excel = new Excel.Application();
excel.Visible = true;

excel.Range["A1"].Value2 = "Process Name";
excel.Range["B1"].Value2 = "Memory Usage";

var processes = Process.GetProcesses()
.OrderByDescending(p => p.WorkingSet64)
int i = 2;
foreach (var p in processes)
excel.Range["A" + i].Value2 = p.ProcessName;
excel.Range["B" + i].Value2 = p.WorkingSet64;

Excel.Range range = excel.Range["A1"];
Excel.Chart chart = (Excel.Chart)excel.ActiveWorkbook.Charts.Add(
After: excel.ActiveSheet);

chart.ChartWizard(Source: range.CurrentRegion,
Title: "Memory Usage in " + Environment.MachineName);

chart.ChartStyle = 45;

if (copyToWord)
var word = new Word.Application();
word.Visible = true;


You can also embed your PIAs in your assemblies rather than carrying them around and the runtime will use Type Equivalence to figure out that your embedded types are the same types it needs and it'll just work. One less thing to deploy.

Parallel Extensions

The #1 reason, IMHO, to look at .NET 4 is the parallelism. I say this not as a Microsoft Shill, but rather as a dude who owns a 6-core (12 with hyper-threading) processor. My most favorite app in the Training Kit is ContosoAutomotive. It's a little WPF app that loads a few hundred thousand cars into a grid. There's an interface, ICarQuery, that a bunch of plugins implement, and the app foreach's over the CarQueries.

This snippet here uses the new System.Threading.Task stuff and makes a background task. That's all one line there, from StartNew() all the way to the bottom. It says, "do this chunk in the background." and it's a wonderfully natural and fluent interface. It also keeps your UI thread painting so your app doesn't freeze up with that "curtain of not responding" that one sees all the time.

private void RunQueries()
Task.Factory.StartNew(() =>
foreach (var query in this.CarQueries)
if (this.searchOperation.Token.IsCancellationRequested)

query.Run(, true);
}, this.searchOperation.Token).ContinueWith(_ => this.EnableSearch());

StartNew() also has a cancellation token that we check, in case someone clicked Cancel midway through, and there's a ContinueWith at the end that re-enables or disabled Search button.

Here's my system with the queries running. This is all in memory, generating and querying random cars.12% CPU across 12 processors single threaded

And the app says it took 2.3 seconds. OK, what if I do this in parallel, using all the processors?

2.389 seconds serially

Here's the changed code. Now we have a Parallel.ForEach instead. Mostly looks the same.

private void RunQueriesInParallel()
Task.Factory.StartNew(() =>
var options = new ParallelOptions() { CancellationToken = this.searchOperation.Token };
Parallel.ForEach(this.CarQueries, options, (query) =>
query.Run(, true);
catch (OperationCanceledException) { /* Do nothing as we cancelled it */ }
}, this.searchOperation.Token).ContinueWith(_ => this.EnableSearch());

This code says "go do this in a background thread, and while you're there, parallelize this as you like." This loop is "embarrassingly parallel." It's a big for loop over 2 million cars in memory. No reason it can't be broken apart and made faster.

Here's the deal, though. It was SO fast, that Task Manager didn't update fast enough to show the work. The work was too easy. You can see it used more CPU and that there was a spike of load across 10 of the 12, but the work wasn't enough to peg the processors.

19% load across 12 processors 

Did it even make a difference? Seems it was 5x faster and went from 2.389s to 0.4699 seconds. That's embarrassingly parallel. The team likes to call that "delightfully parallel" but I prefer "you're-an-idiot-for-not-doing-this-in-parallel parallel," but that was rejected.

0.4699 seconds when run in parallel. A 5x speedup.

Let's try something harder. How about a large analysis of Baby Names. How many Roberts born in the state of Washington over a 40 year period from a 500MB database?

Here's the normal single-threaded foreach version in Task Manager:

One processor chilling.

Here's the parallel version using 96% CPU.

6 processes working hard!

And here's the timing. Looks like the difference between 20 seconds and under 4 seconds.


You can try this yourself. Notice the processor slider bar there at the bottom.

ProcessorsToUse.Minimum = 1;
ProcessorsToUse.Maximum = Environment.ProcessorCount;
ProcessorsToUse.Value = Environment.ProcessorCount; // Use all processors.

This sample uses "Parallel LINQ" and here's the two queries. Notice the "WithDegreeofParallelism."

seqQuery = from n in names
where n.Name.Equals(queryInfo.Name, StringComparison.InvariantCultureIgnoreCase) &&
n.State == queryInfo.State &&
n.Year >= yearStart && n.Year <= yearEnd
orderby n.Year ascending
select n;

parQuery = from n in names.AsParallel().WithDegreeOfParallelism(ProcessorsToUse.Value)
where n.Name.Equals(queryInfo.Name, StringComparison.InvariantCultureIgnoreCase) &&
n.State == queryInfo.State &&
n.Year >= yearStart && n.Year <= yearEnd
orderby n.Year ascending
select n;

The .NET 4 Training Kit has Extensibility demos, and Office Demos and SharePoint Demos and Data Access Demos and on and on. It's great fun and it's a classroom in a box. I encourage you to go download it and use it as a teaching tool at your company or school. You could do brown bags, study groups, presentations (there's lots of PPTs), labs and more.

Hope you enjoy it as much as I do.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

.NET 4.1 Preview - New Base Class Library (BCL) Extension Methods - RFC

April 1, '09 Comments [16] Posted in ASP.NET | DLR | Javascript | Learning .NET | Microsoft | Musings | Open Source | PHP | Programming | Python | Silverlight | Source Code | Tools | VB | Web Services | Windows Client | XML
Sponsored By

As web programmers, we use a lot of strings to move data around the web. Often we’ll use a string to represent a date or an integer or a boolean. Basically "1" in instead of 1, or "April 1, 2009" rather than a proper ISO-8601 formatted culture-invariant date.

While these strings are flying around via HTTP it's not a huge deal, but sometimes this loose, even sloppy, use of strings can leak into our own code. We might find ourselves leaving the data times as strings longer and longer, or not even bothering to convert them to their proper type at all. This problem is made worse by the proliferation of JSON, and schema-less/namespace-less XML (that I've often called "angle-bracket delimited files" as they're no more useful than CSVs in that point.

.NET 4.0 is pretty much locked down, but version 4.1 still has some really cool "Futures" features that are being argued about. If we don't know the type of a string, or we want to leave the string, as a string, longer than usual, what if we had an class that could be both a string and another type, essentially deferring the decision until the variable is observed. For example:

StringOr<int> userInput= GetUserInput("Quantity"); 
string szUserInput=userInput.StringValue; 
int intUserInput=userInput.OtherValue;

Sometimes you just don't know, or can't know.

This reminds me of a similar, but orthogonal physics concept, that of the Heisenberg Uncertainty Principle. Sometimes you know that an object is a string, and sometimes you know how long it is, but you can’t know both at the same time.

One of my favorite jokes goes:

Heisenberg gets pulled over by the police. The officer asks, “Do you know how fast you were going?” Heisenberg answers, “No, but I know exactly where I am!”

This library doesn't solve THAT issue, with respect to strings, but we’ve got folks in DevDiv working on this and many other metaphysical - and physical - problems as they apply to computer science.

Big thanks to Eilon, who's working hard to get this pushed into the .NET 4.1 Base Class Library. Visit Eilon's blog for more details on this new library, more code, graphics and details on how Intellisense will handle this new case.

Hopefully, someone is working to make this important new library Open Source.

Your thoughts, Dear Reader?

Related Posts

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

BizSpark - Free Software and Production Licenses for Startups in the Startup Phase

January 27, '09 Comments [21] Posted in ASP.NET | ASP.NET MVC | Cloud | Programming | VB | Windows Client
Sponsored By

BizSpark LogoLast November, Microsoft started a new program called BizSpark for startups that's pretty sweet. It's pretty not-too-evil also.

If you are a small business and you sell a product or service to your customers, you might want to check it out. Here's the criteria:

  • Actively engaged in development of a software-based product or service that will form a core piece of its current or intended business.
  • Privately held, and in business for less than 3 years.
  • Less than US $1 million in annual revenue.

What do you get?

Here's what you get from the program:

Development Tools, Platform Technologies and Production Licenses

  • All the software included in the Microsoft® Visual Studio® Team System Team Suite (VSTS) with MSDN Premium subscription
  • Expression Studio Version 2
  • VSTS Team Foundation Server (standard edition)
  • Production use rights to host a “software as a service” solution (developed during participation in the BizSpark Program, on any platform) over the Internet, with regard to the latest versions of Microsoft products including:
    • Microsoft Windows Server® (all editions up to and including Enterprise)
    • Microsoft SQL Server (all editions)
    • Microsoft Office SharePoint Portal Server
    • Microsoft System Center
    • Microsoft BizTalk Server
    • Microsoft Dynamics CRM (coming soon)
  • In addition to the core program offering, BizSpark startups will be eligible for other Microsoft offerings, such as:
    • Microsoft Azure Services Platform - The Azure Services Platform is the collection of Foundational, Developer and Live Platform Service such as Windows Azure, Live Mesh, Compute Services, Storage Services, Workflow Services, Identity Services, Connectivity Services, SQL Data Services. All developers will have access to the Azure Services Platform developer tools which includes the local development fabric.

After three years, they assume you've either succeeded and are making money, or you're gone. If you're around and you want to continue, you pay for your MSDN subscriptions the regular way, and if you want to keep using your production licenses, you pay for those using the Service Provider Licensing program.

If you want in, you need to find a sponsor, and there's a list on the site. If you can't find one, though, Bill Staples (a General Manager at MSFT) can sponsor you (details on his site, click "Contact Me" under his picture) which is nice of Bill.

BizSpark is for companies that SELL something (product or service), not for pure consulting companies, but if your consulting company has at least one product or service, that appears to meet the criteria.

I asked folks on Twitter to see if they were using it and if it was a good thing, and everyone said it was a good program. It's a messed up economic time, and I think BizSpark would be an easy way to get a small business or startup idea of the ground without thinking about software licensing for 3 years. If you've got an idea for a business, or you already have a business, this could be the program for you. Tell Bill I sent you (he's one of my many bosses, so be nice and don't get me sacked) and he'll help you get setup.

Are you in this program? Is it a good thing? Leave a comment.

Update: The guy at MSFT who runs the program is Julien Codorniou and feel free to email him at julienco at with questions. Mention my name for free candy (not really).

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Page 1 of 3 in the VB category Next Page

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.