Welcome to MSDN Blogs Sign in | Join | Help

Today I’ve installed Visual Studio 2010 Beta 2 Ultimate on a VHD-booted machine.

The new version of our development tool is based on Windows Presentation Foundation, which means that a lot of new flexibility (e.g. diagrams within the code editor) are possible. VS 2010 comes together with .NET 4 Beta 2.

There’s also a new logo and design for the tool.

MSDN Subscribers can get the public beta 2 on www.msdn.com (which is also redesigned), the rest of you will have to wait until Wednesday.

See below the screenshots of the installation:

VS2010_1

The good old “Start Installation” dialog, in new design.

VS2010_2

The new Visual Studio Wave, as the installer is loading.

VS2010_3

Press “Next” to start installation.

VS2010_4 

EULA Agreement, and prerequisite installation.

VS2010_5

Selection of components to be installed:

Note – This screen got lots slimmer. With the new Ultimate edition you can choose between different languages to be installed, as well as VSTO for Office and Sharepoint Tools.

 

VS2010_6

Installation Screen – Component Overview

VS2010_7

WE’RE DONE! This is the new start screen of Visual Studio 2010.

VS2010_8

Now with environment settings for “Visual F#” and “Web Development (Code Optimized) as well as “Project Management Settings”.

VS2010_9

Here we are.. The new welcome screen! Isn’t it beautiful :-)

Recently I came across a problem with Windows Communication Foundation Services and IIS 7.

What I did is, deploy a .SVC file to my IIS 7.

The service worked during development on the local ASP.NET Dev Webserver, but after deploying it to the server, there was an error:

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

The configuration section 'system.serviceModel' cannot be read because it is missing a section declaration.

Another error might be:

Unhandled Exception: System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (405) Method not allowed

After some research I found the problem: WCF Services are not registered on the IIS!

To fix it, follow these steps:

  1. Make sure ASP.NET pages work on IIS (if not see below).
  2. Execute the following command with elevated privileges (as administrator):
    "%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -i

If ASP.NET pages neither work, register ASP.NET first:

  1. Open a command prompt as administrator.
  2. Execute the follow command:
    "%WINDIR%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe" –i

For more details see the MSDN documentation:

0 Comments
Filed under: ,

During the last weeks I’ve been working on a Silverlight sample application called “CodeFest-Meals”. The sample application was built for a webcast series we’re doing on www.codefest.at. One of the goals of the application was to have a nice-design. So Wolfgang Hofellner, who is also the artist of Schabus & Knor comics, designed a nice user interface for me.

image

Normally I’m more of a XAML guy, but for this series I really forced myself to use NO XAML at all. Everything was done within the new Expression Blend 3. And i really need to admit, it was lots of fun! No XAML any longer for me, at least for CodeFest Meals ;-)

If you’re interested in seeing me doing the entire application completely in Expression Blend 3, have a look at our On-Demand or Live- webcast series.

 

Live Webcasts - Overview over different topics in Silverlight:

On-demand Webcasts – More in depth episodes on Silverlight:

And last but not least

Btw: I’m doing an event on Silverlight advanced topics in Vienna on September 25th, which will also be recorded. See here for details.

0 Comments
Filed under:

This weekend I’ve built a small application, which queries the “Simpsons” seasons guide data and updates the filenames/descriptions. To do this I needed to query a CSV file. While searching for a LINQ to CSV file implementation I’ve found an interesting list of LINQ Providers provider by MVP Charlie Calvert.

  • LINQ to CSV
  • LINQ to Amazon
  • LINQ to Active Directory
  • LINQ to Bindable Sources (SyncLINQ)
  • LINQ to C# project
  • LINQ to Continuous Data (CLinq)
  • LINQ to CRM
  • LINQ To Geo - Language Integrated Query for Geospatial Data
  • LINQ to Excel
  • LINQ to Expressions (MetaLinq)
  • LINQ Extender (Toolkit for building LINQ Providers)
  • LINQ to Flickr
  • LINQ to Google
  • LINQ to Indexes (LINQ and i40)
  • LINQ to IQueryable (Matt Warren on Providers)
  • LINQ to JSON
  • LINQ to LDAP
  • LINQ to NHibernate
  • LINQ to JavaScript
  • LINQ to LLBLGen Pro
  • LINQ to Lucene
  • LINQ to Metaweb(freebase)
  • LINQ to MySQL, Oracle and PostgreSql (DbLinq)
  • LINQ to NCover
  • LINQ to Opf3
  • LINQ to Parallel (PLINQ)
  • LINQ to RDF Files
  • LINQ to Sharepoint
  • LINQ to SimpleDB
  • LINQ to Streams
  • LINQ to Twitter
  • LINQ to WebQueries
  • LINQ to WMI
  • Linq To WIQL
  • LINQ to XtraGrid
  • Windows 7 has a really useful feature called “VHD Boot”. With that you can boot your entire Windows out of a Virtual Hard Disk file (as those used with Virtual PC or Virtual Server).

    This VHD file is mounted as a virtual disk, you can use it as a normal hard disk drive, but all the data is stored in ONE file. The machine is booted physically (unlike with Virtual PC), so you can only run one at a time, but have the full machine’s power.

    The advantages are magnificent:

    • Simply copy one file (the .VHD file) and you’re entire system is included.
    • Create incremental VHD files: One VHD file can be based on another one. So if you have different systems, create a base Win7 VHD and make all others incremental. This will save a lot of disk space!

    There’re also some small disadvantages :-)

    • The .VHD booted OS needs to be Windows 7, Windows Server 2008 R2 or later.
    • There’s a performance decrease of about 3%.
    • Hibernate and some BitLocker scenarios don’t work
      (BitLocker CAN be used within the guest VHD though, but not on the disk where the VHD resides).
    • Windows Experience index won’t work.

    For the last three months, all my machines have been running as VHD booted ones.

    Btw. you can exchange physically booted VHD file with Virtual PC VHD files. All you need to do is running sysprep /generalize /oobe. Also the OS needs to be 32-Bit because of Virtual PC.

    So how do you install a VHD-Boot machine?

    1. Boot the system with a setup DVD or USB stick.
    2. At the setup screen, don’t choose “Install Now”, but press “Shift-F10” to get into command line mode [thanks to the many feedbacks for this shortcut!].
      2 
    3. Enter diskpart to start the partitioning utitlity.
      image
    4. Create a new VHD file by entering

      create vdisk file=”D:\pathToVhd.vhd” type=expandable maximum=maxsizeInMegabyte


      For differencing VHDs you need to add an additional parameter parent=”D:\pathtoparent.vhd”.
      image
    5. Now select the new VHD and attach it as a physical disk.

      select vdisk file=”D:\pathToVhd.vhd”
      attach vdisk

      image
    6. After that switch back to the setup window (e.g. using ALT+TAB) and start the setup.
      2
    7. Proceed the normal setup, but make sure you install to the correct disk (normally the last one), ignore the “Windows cannot install to this disk” warning!!

    At next startup, you’ll see Windows 7 in the boot menu!

    Optional: If you want to add a VHD manually to the boot menu, you just need to copy an existing entry and set some parameters:

    bcdedit /copy {originalguid} /d "New Windows 7 Installation"
    bcdedit /set {newguid} device vhd=[D:]\Image.vhd
    bcdedit /set {newguid} osdevice vhd=[D:]\Image.vhd
    bcdedit /set {newguid} detecthal on

     

    Btw: My colleague Stefan has posted a detailed article on incremental disks.

    These days I'm travelling around austria with our biggest developer & IT Pro event Big>Days 2009!

    This year's theme was "packen wir's an" - translated "let's get to work"!

    Accompanying the theme we built a multi-tier application with .NET 3.5 and Silverlight called "Rent-A-Worker"!

    You can download the sources at http://www.codeplex.com/BigDays09/!

    If you're interested in the slides of my four sessoins, feel free to get them here

    IE 8 Searchbar – Instant Answers is really cool (see below).

    image_11 

    There’s only one problem: It doesn’t work in Austria (as in many other countries). I suppose it only works in the US :-)

    To make it work, you need to change the regional settings to “English-US”.

    There are two ways to do it

    • Change your regional settings :-) (that’s really bad…)
    • Change the settings of the search URL

    The latter is the more interesting I suppose!

    I had a look at the registry and found out that there is a setting for the search provider suggestion URL.

    [Updated for BING] It’s under

    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\
    SearchScopes\{0116A124-45AC-4E95-81CF-08D9FD996515}

    image

    There go to SuggestionsURLFallback and you will see that the URL ends with &FORM=IE8SSC&market={Language}. All you need to do is change {Language} to en-us.

    Voila! Instant Answers will work for you, whatever your machine settings are.

    You can download the registry .REG file here. (Just double click on it, to import the setting). [Update for BING]

    I’m sure all of you know the search box in Internet Explorer!

    You can search ANY searchable site there via pluggable search providers.

    Per default some of them are installed, but you can add your own!

    Here’s how to do it:

    • Go to the page you want to search through.
    • Search for “TEST”.
    • Copy the URL of the search result page (where TEST should be in somewhere)
    • Now go to the Internet Explorer Search Page and paste the URL in the rst textbox.
       
    • Choose a name and select install.
    • Now you have a new search provider in the search box, which will search the wanted page (and substitute TEST with your search text).
       

    Note.. the search providers are standardized and will work in any browser, which supports the open search specification.

    Note 2: Some sites are clever enough to include a search provider already!

    Read here how you can solve equations, get the current weather or other thing directly in the search box.

    Now that I’m running Windows 7 I’m using the new IE 8 as well. Recently I found a cool new feature called “Instant Answers”.

    Just enter some queries into the search box and you’ll get the answer in the drop-down box below the search box.

    There are different possible queries:

    image
    Calculations (2+2, …)
    image
    Conversions (75 C in F, …)
    image
    Weather (with or without location)
    image
    Equations
    image
    Definitions (*smile*)
     
    3 Comments
    Filed under: ,

    I’ve had a little playground TFS 2008 installation for a while for use with some “pet-projects”. I used TFS 2008 Workgroup Edition for this, as this is already part of MSDN subscription package. This edition works the same as the full one, but is limited to 5 users.

    Now that I needed more user accounts for a larger project I tried to upgrade to TFS 2008 Standard Edition.

    This seems to be pretty easy:

    1.) Open Add/Remove Programs in control panel.
    2.) Select “Visual Studio 2008 Team System – Team Foundation Server” and choose “Change”.

    3.) At the TFS setup, select “Upgrade” and enter the new serial number.

    4.) Finished.

    (Summarized from Brian Harry's Weblog)

    This is great, but unfortunately the serial number boxes are disabled / grayed out on my system (and all others as well) :-)

    So it’s harder than expected…

    But.. thanks to a thread in the MSDN Forums I found a way to change the serial number.

    All you need to do (as step 0.) is open setup.sdb in
    "Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Microsoft Visual Studio 2008 Team Foundation Server - ENU"
    and change the [Product Key] value (skip the dashes).

    Voila!

    NET_v_rgb2.jpg I’ve a lot of New Year’s resolutions for 2009 :-) One of them is to blog more often (we’ll see how this works..) another is to do a series of webcasts around WPF.
    We’re starting with our first WPF webcast on Friday, January 9th at 10am with an overview over WPF and XAML.

    Topics we’ll cover:
    *) Why a new UI framework
    *) What tools, frameworks, .. do we need for WPF?
    *) What is XAML, what is it’s syntax.

    >> Register now at the Webcast Website

    I bought myself an Acer L5100 Media Center PC, running with Windows Vista Media Center for Christmas.

    What I wanted was some functionality to wake up the media center out of shutdown mode. So I dig into Wake-On-Lan.

    Almost any modern network interface controller (NIC) supports Wake-On-Lan nowadays. You just send a special packet as a broadcast containing the layer2 MAC address of the NIC and it will boot up the computer immediately.

    So I tried to write my own WOL client with C#. And it turned out it’s pretty easy.

    public static class WakeOnLan
    {
        public static void WakeUp(string macAddress, string ipAddress, string subnetMask)
        {
            UdpClient client = new UdpClient();
    
            Byte[] datagram = new byte[102];
    
            for (int i = 0; i <= 5; i++)
            {
                datagram[i] = 0xff;
            }
    
            string[] macDigits = null;
            if (macAddress.Contains("-"))
            {
                macDigits = macAddress.Split('-');
            }
            else
            {
                macDigits = macAddress.Split(':');
            }
    
            if (macDigits.Length != 6)
            {
                throw new ArgumentException("Incorrect MAC address supplied!");
            }
    
            int start = 6;
            for (int i = 0; i < 16; i++)
            {
                for (int x = 0; x < 6; x++)
                {
                    datagram[start + i * 6 + x] = (byte)Convert.ToInt32(macDigits[x], 16);
                }
            }
    
            IPAddress address = IPAddress.Parse(ipAddress);
            IPAddress mask = IPAddress.Parse(subnetMask);
            IPAddress broadcastAddress = address.GetBroadcastAddress(mask);
    
            client.Send(datagram, datagram.Length, broadcastAddress.ToString(), 3);
        }
    }

    All you need to do is create a packet with 6 times 0xFF at the beginning.

    Then send 16 times the mac address of the machine you want to wake up.

    This is done with the UdpClient class of the .NET Framework.

    The target address of the packet is the broadcast address of the network, which I calculate with the help of the IPAddress Extensions from the earlier blog post.

    Feel free to download the sources here.

    3 Comments

    Attachment(s): WakeOnLan.zip

    Recently I wanted to develop a wake-on-lan application for my media center.

    For that I needed the broadcast address of my local LAN.

    So I decided to write a small but interesting library.. (you can leverage it for all kinds of network calculations like subnets, etc..).

    What it does is do a lot of funny calculations around IPv4.

    • Network Address: This is the first address of each network which is reserved to identify the entire network (or subnet).
      If your ip address is                    192.168.2.234
      and your subnetmask                 255.255.255.0
      then your network address is    192.168.2.0.
    • Broadcast Address: This is the "send-to-all" address. If any traffic is targeted for the broadcast address it is forwarded to all of the machines in the network.
      If your ip address is                    192.168.2.234
      and your subnetmask                 255.255.255.0
      then your broadcast address is  192.168.2.255.

    Are you interested in the calculations behind that? Visit my other blog post.

    In .NET there is a class called System.Net.IPAddress, which is used for storing IPv4 addresses. So what I did is build a bunch of extension methods for this class:

    public static class IPAddressExtensions
    {
        public static IPAddress GetBroadcastAddress(this IPAddress address, IPAddress subnetMask)
        {
            byte[] ipAdressBytes = address.GetAddressBytes();
            byte[] subnetMaskBytes = subnetMask.GetAddressBytes();
    
            if (ipAdressBytes.Length != subnetMaskBytes.Length)
                throw new ArgumentException("Lengths of IP address and subnet mask do not match.");
    
            byte[] broadcastAddress = new byte[ipAdressBytes.Length];
            for (int i = 0; i < broadcastAddress.Length; i++)
            {
                broadcastAddress[i] = (byte)(ipAdressBytes[i] | (subnetMaskBytes[i] ^ 255));
            }
            return new IPAddress(broadcastAddress);
        }
    
        public static IPAddress GetNetworkAddress(this IPAddress address, IPAddress subnetMask)
        {
            byte[] ipAdressBytes = address.GetAddressBytes();
            byte[] subnetMaskBytes = subnetMask.GetAddressBytes();
    
            if (ipAdressBytes.Length != subnetMaskBytes.Length)
                throw new ArgumentException("Lengths of IP address and subnet mask do not match.");
    
            byte[] broadcastAddress = new byte[ipAdressBytes.Length];
            for (int i = 0; i < broadcastAddress.Length; i++)
            {
                broadcastAddress[i] = (byte)(ipAdressBytes[i] & (subnetMaskBytes[i]));
            }
            return new IPAddress(broadcastAddress);
        }
    
        public static bool IsInSameSubnet(this IPAddress address2, IPAddress address, IPAddress subnetMask)
        {
            IPAddress network1 = address.GetNetworkAddress(subnetMask);
            IPAddress network2 = address2.GetNetworkAddress(subnetMask);
    
            return network1.Equals(network2);
        }
    }

    The first two calculate the Broadcast- as well as the NetworkAddress. With the help of the network address you can then calculate whether two IP addresses are in the same subnet (simply by comparing the two network addresses). If they are.. fine, communication is done directly. If not, then the default gateway (a router) is used for the communication between them.

    These extension methods (keep in mind they’re in a static class, are static methods and have the special this (extension) parameter) extend an existing type (at least it seems so to use when using Visual Studio). Now we can call..

    var ip1 = IPAddress.Parse("192.168.0.1");
    var ip2 = IPAddress.Parse("192.168.1.40");
    var mask = IPAddress.Parse("255.255.255.0");
    bool inSameNet = ip1.IsInSameSubnet(ip2, mask);

    I’ve used the GetBroadcastAddress method in another sample to send a Wake-On-Lan packet to ALL computers on my subnet.

    The subnet mask indicates how large the network is. To ease work with it I’ve also built a helper class called Subnet.

    public static class SubnetMask
    {
        public static readonly IPAddress ClassA = IPAddress.Parse("255.0.0.0");
        public static readonly IPAddress ClassB = IPAddress.Parse("255.255.0.0");
        public static readonly IPAddress ClassC = IPAddress.Parse("255.255.255.0");
    
        public static IPAddress CreateByHostBitLength(int hostpartLength)
        {
            int hostPartLength = hostpartLength;
            int netPartLength = 32 - hostPartLength;
    
            if (netPartLength < 2)
                throw new ArgumentException("Number of hosts is to large for IPv4");
    
            Byte[] binaryMask = new byte[4];
    
            for (int i = 0; i < 4; i++)
            {
                if (i * 8 + 8 <= netPartLength)
                    binaryMask[i] = (byte)255;
                else if (i * 8 > netPartLength)
                    binaryMask[i] = (byte)0;
                else
                {
                    int oneLength = netPartLength - i * 8;
                    string binaryDigit =
                        String.Empty.PadLeft(oneLength, '1').PadRight(8, '0');
                    binaryMask[i] = Convert.ToByte(binaryDigit, 2);
                }
            }
            return new IPAddress(binaryMask);
        }
    
        public static IPAddress CreateByNetBitLength(int netpartLength)
        {
            int hostPartLength = 32 - netpartLength;
            return CreateByHostBitLength(hostPartLength);
        }
    
        public static IPAddress CreateByHostNumber(int numberOfHosts)
        {
            int maxNumber = numberOfHosts + 1;
    
            string b = Convert.ToString(maxNumber, 2);
    
            return CreateByHostBitLength(b.Length);
        }
    }

    This class provides constant subnet masks for Class A-C networks as well as methods for calculating subnet masks. A subnet mask is 32-bit long which consist of the network-part as well as the host-part. The methods create subnet masks either by the number of bits in the host- or network part or by the number of hosts, which should fit into the network.

    var classCMask = SubnetMask.CreateByNetBitLength(24);

    creates a subnet mask with 24-bits network part, hence a class C subnet mask.

    Have a lot of fun with IP calculations and visit my post about a wake-on-lan client.

    Also feel free to download the sources here.

    Last week I was in Dublin doing two sessions on WPF for Microsoft Ireland.

    They did a "Client-UI Day", where they featured WPF and Silverlight.

    phone pics 037

    The first session was given by the Irish Developer Evangelist Ronan Geraghty, who did an introduction to the Microsoft Client Platform, showing the differences between AJAX, Silverlight, WPF and when to use what.

    Next I did a WPF for beginners session, where I showed all the details of XAML, Databinding, Styles, Templates, etc...

    Afterwards my colleague Martha Rother from Ireland did a session on Silverlight.

    Last but not least I showed how to leverage WPF and Composite WPF Guidance ("Prism") to build business applications.

    Overall a really nice event, with around 80 attendees and a lot of interesting ideas and feedback on the Microsoft Client Continuum.

    If you're interested in my slides on WPF Introduction and Composite WPF, find them here:

    WPF Sessions.zip

    Going home from Ireland I took two flights via London.. What a bad choice.. I drove to Dublin Airport at 6:30 am, arriving in Vienna at 5pm :-) Almost half a day of traveling and waiting...

    The Silverlight Toolkit is a project built by the Silverlight product team, which contains a lot of "out-of-release cycle" controls.

    These are grouped into three parts:

    • Controls
    • Charts
    • Themes

    Controls include various nice controls (lots of them already part of WPF):

    • Auto Complete Textbox
      AutoCompleteBox example
    • DockPanel
      DockPanel example
    • Expander
      Expander example
    • Label
    • NumericUpDown
    • TreeView
      TreeView example
    • Viewbox
    • WrapPanel

    These controls are especially useful if you plan to write business applications. Also they have similar controls in WPF, so if you plan to port your apps from Silverlight to WPF they come in handy as well.

    The second part contains a number of various chart controls.

    image image image

    As third part, the toolkit contains a couple of themes, which can be applied to your controls.image

    Download the Silverlight Toolkit from http://www.codeplex.com/Silverlight/.

    1 Comments
    Filed under:
    More Posts Next page »
     
    Page view tracker