Thursday, March 20, 2008

 

On Wednesday we had the 1-day free multi-track event in the UK to celebrate the launch of Visual Studio 2008, Windows Server 2008 and SQL Server 2008.

The Windows and SQL tracks basically took the identical slides/demos from the US launch and found local speakers to deliver them. The benefit of that is that the content is not a million miles from the UK Virtual Launch site (which has the US recordings).

For the Visual Studio track I specified session titles and abstracts for 8 complementary developer sessions and "recruited" top speakers to deliver it. If you were there and need to contact the speakers for resources here are links for finding them: Guy Smith-Ferrier, David Gristwood, Andy Wigley, Michael McClary, James O'Neill, Amanda Silver, Mike Taulty, Mike Ormond and mine.

Labels:


 

I have created a Smart Client session that I am repeating at various events and it is basically 5 demos. If you attended that session and heard me refer to my blog for more detailed videos of the 5 things, then please find the list below:

1. WPF and WinForms Interop: blog, screencast.
2. Managed AddIn Framework: blog, screencast and code.
3. Client Application Services: blog, screencast and code.
4. ADO.NET Sync Services v1.0: blog, screencast and code.
5. VSTO v3.0: blog and screencasts.

In addition to those links, when people ask me about other Visual Studio 2008 resources I always point them to the Top 10 and they are happy so hope you are too :)

Labels:


Monday, February 25, 2008

 

One of the hidden gems of .NET Framework v3.5 is the Managed AddIn Framework (MAF) that I've touched on before on these 3 short blog posts: AddIn.dll, Windows.Presentation.dll, VSTO dependency on it.

It is not the easiest of technologies to get your head around without some guidance, so I hope you find useful this introductory quickstart 18-minute screencast (part 1). If you are then hungry for more and in particular on how the MAF delivers on version resiliency, then watch my second 18-minute screencast (part 2). You can get all 3 states by downloading this ZIP file of all Visual Studio projects.

Labels:


Saturday, February 23, 2008

 

Back in May 2007 I posted (Client Application Services) some links that completely describe this new VS2008 and Fx 3.5 feature. If you missed it back then, then please revisit the post to read about it.

If you prefer watching an 18' video that fully gets you started, I have exactly that for you on channel9: Client Application Services with VS2008. The final code that I created is in these two projects.

Labels:


Thursday, February 21, 2008

 

With the release of Visual Studio 2008 we also get v1.0 of ADO.NET Synchronization Services that allows you to build Occasionally Connected Applications by allowing synchronization of remote data with a local cache of the data. Sync Services is the first part of the larger framework still in development: Microsoft Sync Framework (MSF). MSF was part of the announcements at Tech Ed Europe 2007. The first CTP of the Sync Framework is available and it includes a pre-release of v2.0 of Sync Services for ADO.NET. Stay tuned on the Sync Framework blog (which includes links to other relevant blogs down the side). I also believe there will be an update near the SQL Server 2008 release, but I am not sure. There is a very useful FAQ on Sync Services on Steve's blog.

To be clear, here I am still talking about v1 of Sync Services, which ships with VS2008 RTM. If you do not have VS2008, you can still get Sync Services by downloading SQL Compact Edition v3.5 (which is what holds the local cache). Included in the download are the 3 assemblies that complete the picture. So you may be thinking: "if I can get it as a standalone download, why use VS2008 and not stick with VS2005?". The answer is that there is a very smart Configure Data Synchronization dialog wizard as part of VS2008 that generates tons of code and also performs other actions that IMO are too tedious for easily using VS2005 with Sync Services. To invoke the wizard in a new VS2008 project (v2.0 or v3.0 or v3.5) right click on the project node and add new item and choose the "Local Data Cache" item template – then just follow your nose (or the documentation and numerous links above ;-))

If you want a quick intro then put 15 minutes aside to watch my screencast introducing the ADO.NET Sync Services. The Visual Studio project that I create in the video can be downloaded here.

Labels:


Monday, February 11, 2008

 

A long time ago I created a hyperlinked list of the new assemblies in .NET Framework v3.5 and the only one that did not have a hyperlink was the WMI assembly (item 6 on the list).

So, I was very pleased that in last week's MSDN Flash we published a 500 word succinct article on that very topic. For the non-Flash subscribers, scroll down on this page to read it.

Labels:


Wednesday, January 16, 2008

 

Finally, what was promised back in October is now available to everyone with Visual Studio 2008 installed: debug into the actual .NET Framework source code!

All you need is VS2008 and 15' to watch my screencast that shows you step-by-step how to enable this feature.

While watching my video start downloading the hotfix for VS2008 which will make the whole experience a lot faster than what it is without it. Note: I recorded the video without the QFE.

For questions and/or more info, visit the blog of the man that made this feature possible.

Labels:


Tuesday, December 11, 2007

 

For those of you using the DataSet, you'll be happy to know that there are enhancements to it, including these three:

1. Hierarchical Updates: Read.
2. Separate DataSets and TableAdapters for multi-tier solutions: Read, watch.
3. LINQ to DataSet: Read and Watch.

Bonus: Read a nice collection of How To and walkthrough articles for the dataset designer.

Labels:


Monday, December 10, 2007

 

I have already written about LINQ to DataSet, and for more details than what I provided you should follow the links I suggested on that post. In addition, I just published an 18' video on LINQ to DataSet which I hope you enjoy...

Labels: ,


Tuesday, December 04, 2007

 

When I first realised that the prop snippet now generates automatic properties in C# I thought it was cool. The more I write code in VS2008 though I find that when I need to write a property with get/setters that are explicitly implemented, it becomes tedious – I used to rely on prop in VS2005 too much I guess. This is easily rectified by adding a new code snippet of course.

Creating snippet is so easy it should be illegal :), but to save you the manual work here is the one I created for this purpose (propOld). Simply "save as" to your local drive and then from Visual Studio 2008 menu "Tools->Code Snippet Manager" click the "Import" button; then in a C# file type proOLD and hit TAB (instead of prop+TAB).

Labels:


Tuesday, November 27, 2007

 

Visual Studio 2008 uses C# 3.0 and VB9. It uses the same version of the compiler regardless of which version of the framework you are targeting. I've talked about every new language feature and how they can be used cross-framework before, so I won't repeat myself – jump to item 4 of this post.

All I am going to do in this post is offer the slide we use at UK events that demonstrates pictorially the overlap of features between the two languages and where each one differs in terms of new features. This slide was started by my colleague MikeT (who has a great selection of UK VS2008 resources); I evolved the slide to look like this:

Labels:


Monday, November 26, 2007

 

I started the Beta 2 to RTM changes on this post and then posted some breaking changes about this, that and the other and also posted some minor amendments here and there. To close it all off, below are the remainder differences that I observed:

1. If you access the Samples via the Help menu, you'll notice there is now a Readme displayed (apparently some people fell over at the first hurdle that the readme addresses).
2. Previously in web projects, you would access the "Manage Styles" and "Apply Styles" windows from the Format menu. Now the two menu items have moved to the View menu under their brother who was always there: "CSS Properties".
3. The Database Publishing Wizard is now built in to Visual Studio, no need for separate download:


For more, please do read the Visual Studio 2008 readme which includes the steps required to go from Beta 2 to RTM.

Labels:


Saturday, November 24, 2007

 

I was reading this post on the VB blog about hidden gems in VB with the VS2008 release. I knew all of them until I came to item 8: the "Go To Type Definition" menu (I am not sure if this was functional in Beta 2...). This is available only on the variable declaration and it takes you to the definition of the type of the variable.

But hang on! Couldn't we always do that? Yes, we could: The existing "Go To Definition" menu does that if you execute it by right clicking on the type rather than the variable. So, the only benefit of the new "Go To Type Definition" menu is for scenarios where you are using local variable type inference and hence don't have the type explicitly appear in your code (in order to use the existing "Go To Definition" menu).

I thought that was cute, but something was bugging me about introducing a whole new menu item for this purpose. Couldn't the VB team simply go to the type definition if I selected "Go To Definition" on the Dim keyword? I checked with some C# code that uses local variable type inference, and indeed that is what it does when you select "Go To Definition" on a var. As it happens, I prefer C#'s approach on this one.

Regardless of what I prefer, I would have like some consistency here between the two language approaches but I am sure this is where the product teams tell me that they are catering for two different audiences and I don't want to open that can of worms again.

I'll finish off by saying that I prefer what VB means by go to definition for a type, as opposed to how C# does it. In VB, going to a type definition that is not in your code, is interpreted as going to the Object Browser. In C# (since VS2005), it disassembles the signatures of the type from the external binary and presents it in C# code in a separate file – yuck! Why can't C# just take me to the OB where I can see in a more concise format all signatures and documentation? There should be a separate command for disassembling the type in header style just in case I need to copy/paste something... Anyway... mini-rant over.

Labels:


Friday, November 23, 2007

 

...but you need an update. Please read this post for context and where to get the update.

Thanks to one of my readers (Martin Normak) for pointing this out to me.

Labels:


Thursday, November 22, 2007

 

In my global Visual Studio project settings for VB projects I always have Option Strict set to On, so any new VB project I create has this setting without me having to do it manually every time.

If you do the same as me above, then when you create a Visual Basic WPF project in Visual Studio 2008 RTM, you may get a compilation error before you have a chance to write any code:

Option Strict On disallows implicit conversions from 'System.Windows.Application' to 'WpfApplication1.Application'.

Double click on the compilation error in your Error List window and it will open the offending file: MyWpfExtension.vb and specifically the ReadOnly Application property that returns an object of type Application. The problem is that the single return statement does not perform a cast:
Return Global.System.Windows.Application.Current
So you have to change it (or in fact choose the cool auto correction option to change it for you) to:
Return CType(Global.System.Windows.Application.Current, Application)

WARNING: The following step has the potential to irrevocably cripple your machine so take backups if you decide to proceed!

If you want to change this globally on your machine and are willing to take your life into your own hands and venture into unsupported territory then you can edit the following two files (you’ll need to unzip, edit the file, and re-zip):

%programfiles%\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache\VisualBasic\Windows\1033\WPFApplication.zip\MyWpfExtension.vb

%programfiles%\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\VisualBasic\Windows\1033\WPFApplication.zip

Did I mention that the former action is not a supported scenario by Microsoft or endorsed by the product teams? Yes, good.

Labels:


Wednesday, November 21, 2007

 

If you were running Visual Studio 2008 Beta 2 and have just moved to RTM, you'll find these minor changes in the New Project dialog:

1. When clicking on the top level Office node it shows you all the Office templates (2003 and 2007) as per the screenshot; before it would not show you anything.
2. There is a new Reporting node that has the "Reports Application" template that previously was under Windows.
3. The SharePoint Worklfow project templates now also appear under the Workflow node (in addition to appearing under the Office->2007 node).

You'll also find some minor changes in the Add New Item dialog:

4. All the WPF item template icons have had a face lift (as per screenshot above).
5. In client projects there is a new Reporting node (equivalent to item 2 above) that contains two templates: "Report" and "Report Wizard".
6. In a web project there is a new item template for Nested Master Page.

Labels:


Tuesday, November 20, 2007

 

Comparing VS RTM to Beta 2, here is a good one:
Tools -> Options -> Text Editor -> HTML -> Validation

...enjoy the two new checkbox Options to treat errors as warnings :-)

Labels:


 

If you open your existing Beta 2 web projects with VS 2008 RTM, and you were using the new ListView (one of the 3 new web controls), you may face the following error:

System.InvalidOperationException: An item placeholder must be specified on ListView 'ListView1'. Specify an item placeholder by setting a control's ID property to "itemPlaceholder". The item placeholder control must also specify runat="server".

There are two changes to be aware of:
1. Instead of itemContainer (which is probably what you are using from Beta 2), you must now change the id to be equal to itemPlaceholder. Make this change and your project will compile.
2. The control that has the id="itemPlaceholder" does not get rendered at runtime anymore (it gets removed and replaced with multiple instances of the ItemTemplate). So if you were using for example a ul and had some CSS on it for the li, this styling is now lost. The solution, of course, is to place the outer element (e.g. ul) on its own and within it place a asp:Placeholder whose ID you set to "itemPlaceholder".

An example of both of the above:
<LayoutTemplate>
<ul class="myCSSrule">
<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
</ul>
</LayoutTemplate>
Easy once you know how ;-)

Labels:


 

If you open your existing Beta 2 web projects with VS2008 RTM you may face the following error:

Could not load file or assembly 'System.Data.DataSetExtensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

The reason for this is that many of the pre-release Fx 3.5 assemblies did not have their version set to 3.5 yet (I covered that in this post), but now they do. So if you change the version from "2.0" to "3.5" in the web.config file your project will build fine again.

At the bottom of that same post I also mentioned the weirdness of System.DirectoryServices.AccountManagement and you'll be pleased to hear that it is now placed in the correct folder and does appear in the references dialog as well.

Labels:


Monday, November 19, 2007

 

Judging by the amount of emails I received, not everyone is an MSDN subscriber and my smiley face didn't put you off from telling me that! So, for the non-MSDN subscribers, if you cannot wait for the general availability date early next year, download a trial now and upgrade later.

Labels:


 

All MSDN subscribers can now down load the final RTM version of Visual Studio 2008. If you are not an MSDN subscriber, I guess this is a great incentive to join right now :-p

If you are looking for what is great in VS2008 compared to VS2005 go read my Top 10 hyperlinked list.

If you have been driving VS 2008 Beta 2 for a while and are wondering what is new in RTM then the answer is primarily bug fixes and performance boosts. Two (out of many) quick examples: I noticed many bug fixes for WPF projects and performance improvements not just in the WPF designer but also in script intellisense. There are also some minor enhancements and some aesthetic and usability improvements for example some windows render better on low resolutions such as the Client Application Services dialog. Another is that the UAC Settings option which was previously erroneously available for Office projects (instead of just executables) is now correctly disabled. Finally, we now get an Upgrade button on the About dialog:


I'll cover more of these Beta2->RTM changes over the next 2 days, so check back.

Labels:


Friday, November 02, 2007

 

The list below is not in order of importance, instead it is in the order I suggest you explore this new release.

1. VS2008 and Fx 3.5 will officially launch together in February but will be available to developers by the end of November 2007. The same type of Visual Studio SKUs/Editions available with VS2005 will also be available with VS2008 including a brand new one: VS2008 Shell. VS 2008 is a great Vista client, has better aesthetics and a bunch of new usability features including enhancements for multithreaded debugging.

2. Fx 3.5 continues with the additive approach that we introduced with Fx 3.0 while still not introducing a new CLR. As a reminder, Fx 3.0 simply added to Fx 2.0 without changing or removing anything in the existing assemblies (it added WPF, WCF, WF and CardSpace). So, Fx 3.5 simply adds some assemblies to the existing set of DLLs that Fx 2.0/3.0 comprises of. This means that simply installing the framework should not affect your existing solutions. Note however that Fx 3.5 depends on Fx 2.0 SP1 and Fx 3.0 SP1, which will ship at the same time.

3. VS2008 has a new simple yet powerful feature: multitargeting. The ability to create projects targeting different .NET Framework versions (2.0, 3.0 and 3.5). This means that even though VS2008 can be installed side by side with VS2005, you do not need VS2005 any longer since VS2008 offers a superset of the functionality.

4. There are many new C# 3.0 and VB9 language features (inc. automatic properties, relaxed delegates, object initialisers, type inference, anonymous types, extension methods, lambdas and partial methods). The compilers emit backward compatible IL, which is to be expected since there is no new version of the CLR. In plain terms this means that all the new language features can be used with existing v2.0 projects (due to the multitargeting feature mentioned above)! VB developers also get enhanced intellisense amongst other IDE features.

5. The headline feature of this release is LINQ (Language Integrated Query). LINQ depends largely on the language features that were introduced and also on bits of the Fx 3.5 (4 assemblies to be precise). LINQ is a new declarative paradigm for querying data sources in a consistent manner, regardless of what the data source is: in memory objects, XML, SQL, DataSet or anything else (because LINQ has been architected to be fully extensible). The future looks even brighter with efforts such as PLINQ.

6. For the web developer, ASP.NET AJAX ships out of the box with improvements and ASP.NET 3.5 includes 3 new controls. There are also enhancements in the IDE that can be used in ASP.NET 2.0 projects too, such as support for JavaScript intellisense and debugging, a new CSS engine and an HTML designer that supports Nested Master Pages.

7. For the client developer, new features include WPF project templates out of the box, a new WPF designer with integrated support for interop between WinForms and WPF. FireFox support for ClickOnce and XBAP deployments. Now, you can take advantage of ASP.NET provider services and also embed UAC manifests for application running on Windows Vista.

8. For the office developer, there is full support for 2007 Office customisations as well as Office 2003 templates. Support include outlook form regions, ribbon customisation, custom task panes, actions pane, Word content control databinding and interop with VBA.

9. For the server developer, WCF and WF templates now ship out of the box and play better together. WCF now supports a SOAP-less HTTP programming model as well as syndication and JSON serialization. There is a good collection of links for these here.

10. For the mobile developer, there are tons of new features including support for Compact LINQ and Compact WCF and many other NETCF features. At the IDE level we get Unit Testing for devices amongst other goodies from the VSD team.

11. Bonus item: It is only via VS2008 that you will be able to debug your code down into the .NET Framework methods.

Labels:


Tuesday, October 30, 2007

 

A neat feature of Visual Studio has always been that you can associate a schema with an XML file and then you get intellisense in the XML for elements and attributes. In fact, if you annotate your XSD file, you can even get comments in the intellisense. Read more about the XML editor on MSDN and if you are sticking with VS2005, check out a much older blog post by Aaron.

Well, the Visual Studio 2005 dialog for picking schemas has had a facelift in Visual Studio 2008. I am talking about the dialog that appears when you have an XML document open and then from the Properties window click on the Schemas property. In VS2005 it looks like this:


On the original dialog above, note how the information presented is in a TreeView: Location of the xsd file (tree nodes with folder icon) and File Name (on the tree node with xsd icon) and the Target Namespace (in brackets on the same node). You can also select the xsd file via the tree node checkbox (i.e. a binary decision: Use or Don't Use). The final thing to note is the (mis)title: XSD Schemas ;-)

In VS2008 you can also bring it up from the XML menu:

...its title bar now has more accurate text:

The body of the dialog does not use a TreeView; instead it is a grid with an XSD file per row and 4 columns (from right to left): Location, File Name, Target Namespace and Use (all of them sortable). Take a glimpse at a full screenshot here and notice how you can easily Remove XSDs as well.

Other than a GUI re-layout (which is an interesting study in its own right if you are into that kind of thing), there is additional functionality. The Use column is not a binary decision like before, but rather a combobox with 3 options as the following screenshot shows:

At this point, I'll hand it over to the new MSDN documentation that describes the 3 options. Essentially, now you can remove the automatic binding to a schema based on a namespace, without having to remove the namespace from the XML file itself.

Labels:


 

When I talk about the .NET Framework v3.5 release, I touch on the enhancements coming for NetFx v3.0 technologies i.e. for WPF, WCF and WF. Invariably there will be a question: What about CardSpace? For CardSpace all I know is that there are UI enhancements (play with the latest bits and you'll spot them). Today, I learned (via Mitch) that you'll be able to utilise CardSpace without an SSL certificate. Any other CardSpace questions, please use the aforelinked blog ;-)

Labels:


Monday, October 29, 2007

 

The top 3 Visual Studio 2008 IDE features for web developers, in my opinion, are:
1. New split view designer with new CSS support.
2. JavaScript intellisense and debugging enhancements.
3. Nested Master Page support.

Note that due to the multitargeting feature, the tool/IDE enhancements are also applicable to developers targeting ASP.NET 2.0 ;)

If you are looking at what is new from a platform perspective, then the top 3 IMO are:
A. ASP.NET AJAX support out of the box - 'nough said.
B. Three new ASP.NET 3.5 controls.
C. ASP.NET MVC Framework. Technically not part of ASP.NET 3.5, but it will be released later as an addition and it is too cool not to mention ;-)

BTW, back in March I listed some other blogs that you should be following for web-specific Visual Studio resources.

Labels:


Friday, October 26, 2007

 

As cool as master pages were when introduced with VS2005/ ASP.NET 2.0, the designer was not capable of rendering nested master pages and I imagine that for some that hindered their ability to make the most of this cool feature. In VS2008, the new HTML designer that is shared with Expression Web supports nested master pages. Read all about this on ScottGu's blog post.

The key is that when you bring up the Add a New Item dialog and select a master page template, it will allow you to check the box that offers the option to base it on an existing master page. See this screenshot.

With earlier drops of Visual Studio, the above only applies when you create a new Web Site. It doesn't apply when you create a new ASP.NET Web Application project, i.e. there is no check box there. See this screenshot.

I strongly suspect that when VS2008 is released, we will have also added a new item template for the latter case... maybe something called Nested Master Page ;-)

Labels:


Sunday, October 21, 2007

 

Having looked at the Office extensibility stuff in Visual Studio 2008 I can honestly say: if you are a windows forms developer and you choose NOT to explore the Office customisation story, then you are genuinely doing yourself a disservice and seriously missing out. I first showed some enthusiasm on this topic through my post: Office development through pictures.

To help you go further, I have recorded 5 short screencasts:
1. Ribbon customisation.
2. Custom Task Panes and Actions Pane.
3. Outlook Form Regions.
4. Word Content Controls.
5. VBA interop with VSTO.

In addition to these videos, there are many online resources to read. There are 6 great dedicated blogs (see links from the bottom of this post) and then there is the online documentation and the Office dev centre. If you have specific questions, please visit the very active free online VSTO Forums.

Labels:


Friday, October 19, 2007

 

Following on from my post about interop between WPF and WinForms, I produced a screencast demonstrating the mechanics. In the process you also get to see the WPF designer in VS2008 if you haven't seen it already. Check out the 17' video here.

Labels:


Wednesday, October 10, 2007

 

Background
Any client developer that has seen a good Windows Presentation Foundation demo/presentation will probably be salivating at the prospect of playing with this cool technology and potentially planning in their heads how they can move their applications from Windows Forms to WPF. The fact is that you don't have to and in fact shouldn't just do that yet, despite what you may have heard from overzealous presenters. Today, WPF is a great choice for consumer applications, ideal for applications where having a WOW factor is part of the requirements and definitely the only choice for software houses that have both designers and developers working on the same projects. For the rest of us building LOB apps, Windows Forms still work great and, even better, can interop with WPF if required for specific use cases. There are many resources for bidirectional interop between WPF and WinForms as well as between WPF and Win32.

The Links
In Visual Studio 2008 we get designer support for these scenarios. If you are in a WPF project simply drag the WindowsFormHost control from the toolbox and point it to a WinForms UserControl. I am more interested in the reverse scenario, so in a Windows Forms project drag the ElementHost and point it to a WPF UserControl and then you can use that WPF control (set properties/call methods, handle events etc) from your winforms. Both of the host classes are implemented in the same namespace, in the WindowsFormsIntegration.dll assembly (part of WPF).

As you can see, other than the two aforementioned classes, there is a PropertyMap class that translates properties from winforms control to WPF elements (with help from the PropertyTranslator delegate) and you can read more about it on MSDN's aptly named Property Mapping page. In the same namespace you can also see 4 subclasses of EventArgs (ChildChanged, IntegrationException, LayoutException and PropertyMappingException) used by events.

"Hello World"
1. In VS2008, create a new WPF User Control Library project.
2. Using the designer for UserControl1.xaml create some UI or paste in the XAML section a UIElement if you already have one.
3. In the same solution, add a new Windows Forms project (in VS2008 target v3.0 or v3.5).
4. From this winforms project add a reference to the WPF User Control project
5. Rebuild all.
6. With the Form1 designer open, open the toolbox and find the UserControl1 that you created (in WPF).
7. Drag it onto the Form1, resize to your liking (it doesn't have to be docked and can coexist with WinForm controls on the form).
Notice how what it effectively did is create an ElementHost for you and set its Child property to the UserControl1? When it adds the ElementHost, it also adds references to the WindowsFormsIntegration, PresentationCore, PresentationFramework, WindowsBase and UIAutomationProvider assemblies. You can repeat the exercise by replacing step 7 with manually dragging an ElementHost onto the form and then using the ElementHost Tasks popup to select the hosted content:

8. Ctrl+F5
9. Exercise for you dear reader: Follow the links above and see what cool sample you can come up with ;-)

Labels:


Wednesday, October 03, 2007

 

In my sessions I always explain the red and green bits story and then focus on describing the enhancements in the green bits – after all that is what people want to hear when attending a session on .NET Framework v3.5. I also make it clear that if you upgrade your projects to VS2008, you can leverage multitargeting to continue to target Fx v2.0.

Take those statements and combine them with my blog posts on the red bits (e.g. start here with this one). It should quickly become obvious that there are few little obscure additions at the public API surface level of v2.0 that, if you do take advantage when targeting v2.0 from VS2008, will result in your code crashing when deployed to a machine that only has v2.0 without the updates. That was a long sentence so feel free to re-read it ;).

The way Krzysztof describes it:
"But now I have to confess, there are some limitations in this design that we accepted when we made the original simplifying assumption. There is a very limited number of APIs being added to the Red assemblies and the multi-targeting system is currently not able to detect these."
To download his FxCop rule that addresses the deficiency in the VS 2008 multitargeting system for this niche scenario, visit his blog post. Note that even if you do not have VS2008, you can still download his Test.csproj and try to build to see the compiler errors in VS2005 on types/methods that do not exist. Go.

By the way, on a not so unrelated note, I found an interesting post which explains why previous versions of Visual Studio only targeted one framework version. Thought I'd share.

Labels:


Friday, September 28, 2007

 

Recently I published a 15' video on a new VB9 and C# 3.0 language feature that is of course usable by projects targeting Fx v2.0 as well. The feature is called Partial Methods (not to be confused with extension methods).

Watch the screencast here.

Labels:


Tuesday, September 25, 2007

 

Rather than writing or screenshoting the new multithreaded debugging enhancements in Visual Studio 2008, I thought I'd create a 15' video to demonstrate them. See if you can spot what the bug is before I "discover" it in my demo ;-).

Labels: ,


Thursday, August 23, 2007

 

One of the improvements in Visual Studio 2008 for building Windows Vista applications that work correctly with User Account Control is the ability to embed manifests in Visual Basic and C# projects. Watch my 15' video to see how.

Labels: ,


Wednesday, August 22, 2007

 

If you ignore the framework and compilers, then what is new in Visual Studio 2008 purely from an IDE perspective? Find out in my 10' video here.

Labels:


Sunday, August 19, 2007

 

If you try to use VSTO v3 in Visual Studio 2008, you'll notice that the project templates are only available when you select .NET Framework v3.5 (via the multitrgeting feature). You'll probably ask yourself "why?".

The answer becomes obvious when you realise that the MAF (part of Fx 3.5) is actually an evolution of the add-in infrastructure used by the Visual Studio Tools for Office team. They worked on this initially and in the 3rd iteration handed it to the CLR team so it could be baked for public use, not just private use by the Office add-ins. So, now they still depend on it of course which is why the VSTO redist depends on Fx 3.5. They also took further dependencies on some of the new security bits in System.Core, WindowsBase in Fx 3.0 for the packaging APIs and some other less major things. Now you know ;-)

Labels:


Saturday, August 18, 2007

 

I got asked about new things in .NET Compact Framework 3.5 with the VS2008 Beta 2 release. Well, the NETCF team did all their good work very early on so there aren't any new features in this drop. Tons of new stuff compared to v2.0 of course, see my previous posts starting here.

In Beta 2 of NETCF 3.5 compared to Beta 1, I observe a couple of classes gone from the WCF stuff, some refactoring in System.Xml.Linq and some changes to mirror the System.Core changes I mentioned here in the 1st paragraph for the full framework.

The only major change is that the DataSet extensions have been factored into their own assembly: System.DataSet.Extensions.dll. This again mirrors the full framework implementation but internally the classes are not in sync yet. They will be by RTM, so my suggestion is to explore the LINQ to DataSet on the desktop, and use the same skills/code when it finally makes its appearance in the NETCF as well.

Labels:


Friday, August 17, 2007

 

I opened the Tools menu of VS2008 Beta 2 and observed three changes compared to Beta 1. Can you spot them without reading beyond the screenshot:

(Obviously the "Upgrade Visual Basic 6 Code..." is not available in C# projects but everything else is the same in C#)

That's right:
1. The "Device Emulator Manager" moved up next to the other Device options.
2. There is a new menu item "Partner Product Catalog" which seems to open a web page with VSIP members.
3. The "WCF SvcConfigEditor" is back. For more on this configuration editor tool visit the relevant msdn page.

Labels:


Thursday, August 16, 2007

 

Want a lightning quick tour of the complete list of .NET 3.5 assemblies and where to find them? Wanna know how I personally explore new DLLs? Watch my 14' video here.

Labels:


 

Soma writes about one of my favourite features of Visual Studio 2008 (that is actually an msbuild feature). If you want to see it in action, watch the 15' video I recorded last week on channel9.

Labels:


Wednesday, August 15, 2007

 

LINQ to SQL has had some positive changes in VS 2008 Beta 2.

The most significant is that it is now faster (for background to this, see Rico's post) and has numerous bug fixes. Another very visible change is that for customisation, partial methods are utilised everywhere (LINQ to SQL was one of the drivers behind that feature). An aesthetic tool change is that when you map your database to the auto generated classes, you do not add a "LINQ to SQL File" item, instead you add a "LINQ to SQL Classes". It also has a much more professional icon rather than the old one that looked like it was drawn by... me! Here is the new one:


Opening System.Data.Linq.dll in your favourite dissasembler will reveal quite a few refactorings, but instead of looking inside out, I'll hand it over to Dinesh that has a fuller change list.

Labels: ,


Tuesday, August 14, 2007

 

I recorded a 13' video on the improvements in VB intellisense (codenamed "intellisense everywhere") with VS2008. For more context and to watch it go here.

Labels:


 

One of the fixes to the updates for CLR v2.0 (that we will receive when Fx 3.5 ships) is ngen performance improvements (inc. for WPF assemblies). Read the full story here.

Labels:


 

Two of my favourite new APIs of Windows Vista are: restart/recovery and Restart Manager.

I mentioned in passing that Orcas March CTP supported the restart API. I haven't had a chance to test if that area has been improved because I can't get Visual Studio 2008 Beta 2 to crash! If you have a repro case that crashes Beta 2, please let me know how.

How about Restart Manager support by Visual Studio 2008? I had tested this with Beta 1 and the answer was "no". Tested it with VS2008 Beta 2 and the answer is a resounding "yes". Not only it supports RM for being gently shutdown, but it actually does the right thing when it is restarted which is to auto open the solution you had open even down to the file you were viewing! If you had a file unsaved, it will prompt you on restart if you'd like to recover:


To see the RM functionality with VS2008 in action on your Vista machine running Beta 2, one easy way is to download my Vista demos, locate the project in the folder "RestartManagerSimulator", build it and then execute from the Debug folder the executable: RestartmanagerSimulator.exe. You should see an app that looks like this. In the textbox enter "devenv" (without the quotes) and hit the buttons in order: "Supports Restart?", "Register" and "Shutdown". Wait while that operation completes and Visual Studio exits. Then click on "Restart" and watch the magic happen ;-)

Labels: ,


Monday, August 13, 2007

 

One of the annoying things of Visual Studio 2005 is that when you try and add a new item to a project the templates are listed in non-alphabetical order and there is no way to change that from the GUI. There are a couple of workarounds for VS2005 (e.g. see links from here), but they involve more work than to my liking.

Visual Studio 2008 improves the story by (almost always in Beta 2) sorting alphabetically :-)

Nice! The same is partially true for the New Project dialog. Also, as an added bonus, both of these dialogs are now resizable as the screenshots prove ;-)

Labels:


Sunday, August 12, 2007

 

I knew about covariance and contravariance that we got in the .NET 2.0 timeframe and I also knew that VB 9.0 (shipping with Visual Studio 2008) would fully support the feature and even enhance it. I hadn't appreciated how much it would be enhanced until I accidentally run into it yesterday (while recording a video on VB intellisense improvements).

I created a thread and had the delegate point to a method that I had already written. So I went to change my method to accept the Object as an argument and before having a chance I noticed that VB's background compiler hadn't complained about it!? In case you haven't guessed it by now, in VB9 you can omit the parameter list of a method pointed by a delegate, if you wish ;-)

Example:
' No need to type (s As Object, e As EventArgs)
Sub Button1_Click() Handles Button1.Click
Dim t = New Thread(AddressOf MyWorkerMethod)
t.Start()
End Sub

Sub MyWorkerMethod() 'No need to type (o As Object)
'Do sth on worker thread
End Sub

Read more about relaxed delegates on msdn (bottom of the article). Like with all other language features, you can use this one in your .NET 2.0 projects in VS 2008.

Labels:


Saturday, August 11, 2007

 

Hot on the trails of the improvement in the foreach code snippet in VS2008, I found that the prop snippet also changed:

Yup, automatic properties by default ;)

Labels:


Friday, August 10, 2007

 

I thought that Scott was trying to steal my thunder with his post about changes from v2.0 to v3.5, but instead he is focusing on the changes in the red bits and not the green bits – thanks! As a reminder the red bits are the same version.

He used libcheck to generate the report. Time for my confession: I have modified libcheck so it works for the .NET Compact Framework and indeed that is what I use to blog here about NETCF changes between v2.0 and v3.5. You can see a very old report of that tool when I was blogging about changes between NETCF v1.0 and NETCF v2.0 RC. I was going to use libcheck for reporting on the red bits, but never found the time to unearth an XP installation with v2.0 RTM on it – shocking I know :-).

I went through the report and other than the obvious additions in the GC the only other change worth talking about is DateTimeOffset which has had a ripple effect to other areas (e.g. XmlConvert.ToDateTimeOffset). Of course, most of the changes to the existing red bits are bug fixes and perf improvements so API differencing will not surface those. An example of an internal change the report will not show is the use of the Vista CommonFileDialog.

Anyway, check out the report on Scott's blog.

Labels:


 

With Visual Studio 2008, like with VS2005, we have the 4 Express Editions (C#, VB, C++, Web) and we also have the Standard and Professional Editions as well. PRO is what I typically use and, with VS2008, PRO now includes support for Unit Testing.

We also have the Team System Editions (Architect, Developer, Test, Database) inc. TFS and Test Load Agent, of course. With VS2008 the names for these have been rationalised and simplified. I may do a post in the future summarising the new stuff in VSTS 2008 (for now, you can view the complete feature list for TFS 2008).

There is also a new kid on the block. I am personally very excited about this and have added to my TODO tome to put aside some time to play with it: Visual Studio 2008 Shell (and its free!).

Labels:


Thursday, August 09, 2007

 

I opened the Help menu of Visual Studio 2008 Beta 2 and observed three additions compared to Beta 1. Can you spot them without reading beyond the screenshot:


That's right:
1. MSDN Forums – browses to the MSDN forums.
2. Report a Bug – on my machine takes me here.
3. Samples – opens an htm file from your machine.

That last one is the most interesting to me. It includes hyperlinks to many sample projects on your machine. Clicking on "Visual C# Samples" will open a ZIP file that has two folders in it, one of them called "LinqSamples" that contains the BuildSamples.sln. Open that and you'll have 15 very interesting projects.

Included in that solution (no need to download anything from the web, contrary to following links) is the Paste XML As XElement add in project, the LinqToSqlQueryVisualizer debugger visualizer project and the ExpressionTreeVisualizer debugger visualizer project. Also, worth the admission fee alone is the SampleQueries project with literally hundreds of sample LINQ to everything queries in a format that you can learn from:

Go explore now!

Labels: ,


Wednesday, August 08, 2007

 

I have updated my Fx 3.5 list of dlls with one more: Microsoft.VisualC.STLCLR.dll.

As its name suggest, this is an assembly for C++ developers. To be clear, it is of no use to C#/VB developers since it is unusable without including the STL/CLR header. The idea is that if you are comfortable with the C++ Standard Template Library (STL) then you can still use the STL from your C++/CLI code. At the same time, it lets you port your existing unmanaged C++ that has investments in STL, to managed C++ without having to re-implement the STL portions – they just work since the STLCLR collections are compatible with the Generic .NET Collections!

For slides, demo and to read more about this assembly, please visit the STLCLR category on Nikola's blog. He has also recorded a video explaining everything about it.

Labels:


Tuesday, August 07, 2007

 

In addition to infrastructure improvements to better support IIS7, and in addition to toolset enhancements, web developers get 3 new controls in ASP.NET 3.5 (specifically in System.Web.Extensions.dll and specifically in the System.Web.UI.WebControls namespace): ListView, DataPager, and now in Beta 2 we see for the first time LinqDataSource.

To read about ListView and DataPager go to Rick's blog and for LinqDatasource see Scott's blog. In addition to those 2 blog posts, Dan has two excellent videos showing off the controls here and here.

Labels:


Monday, August 06, 2007

 

Stumbled upon a great video of Matt Warren (questioned by Luca Bolognese and shot by Charlie Calvert) explaining the pipeline of LINQ to SQL i.e. it assumes you know how to use LINQ to SQL already and builds on that to explain the internals. Watch it here.

Labels: ,


 

Whenever I want to loop through a collection of some sort, in C# I type foreach and hit the TAB key twice (to invoke the code snippet). This gives me the following code template:
    foreach (object var in collection_to_loop)
{

}
...where object is highlighted so you can change it to the real type of your collection, var is highlighted so you can change it if you wish to have your own variable name and collection_to_loop is highlighted so you can change it to your actual collection variable name.

This always looked awkward to me when playing with LINQ since I typically use the keyword var to replace the object and then immediately I am confronted with var as the variable name that I change only so the awkwardness can go away.

In Visual Studio 2008 Beta 2 you get the following with the foreach code snippet:

No awkwardness, automatic use of local variable inference and, generally speaking, only one item to replace: collection.

Are you revisiting your own code snippets making them more user friendly?

Labels:


Saturday, August 04, 2007

 

Recall the new C#3 and VB9 language feature extension methods? Well, if you go into the object browser in Visual Studio 2008, there is an option to display extension methods for the chosen class. The following screenshot depicts that for the XElement (from XLinq):

Nice! The 3 extension methods (Validate and GetSchemaInfo) are actually defined in the static System.Xml.Schema.Extensions class, but still show up where we'd expect them to.

The above screenshot is in a VB project and I cannot get this feature to work reliably for me in C# projects yet. The option is there in both projects, but the result isn't. Here is how you enable the feature btw:

Go check it out...

Labels:


Friday, August 03, 2007

 

With VS2008 Beta 2, we all get a chance to play with a feature that the product teams have been teasing us with by talking about it before it was available in public drops.

[Request to product teams]If your feature is not baked in public bits, please refrain from blogging about it; also please stop posting images of private bits.[end request]

The feature in question is Partial Methods. Wes has an excellent write up here from a C# perspective (that he followed with this) and Scott here from a VB perspective. I suggest you read both since at the conceptual level they are the same. Essentially it is an aid to code generation scenarios in the same way that partial classes are. Think of it as a combination of a more efficient version of private event handlers and the Conditional attribute. Read the previous links for the full story.

My take? I simply thought I'd see the feature in action so without referring to the posts or documentation I fired up Visual Studio to try it out from memory. How mistaken I was. Every time I tried something I was greeted with a compiler error pointing out my ignorance. I was going to post here the series of compiler errors I dealt with one by one until I managed to get the thing to compile, but instead I've tried to summarise a few of them with one line of code:

public partial bool GoGoGo(out int i); //produces the following Error List


What better way to learn than by the compiler teaching you... a bit like how kids learn that fire is hot... by touching it (well, that's the way I learnt anyway). If however you prefer reading a very long thorough post covering a feature (in addition to the 3 posts above by the product teams) and also prefer looking at things through ildasm, then head over to Bart's blog post on the topic.

Labels:


Thursday, August 02, 2007

 

I've shown before one example of VS2008 integrating nicely with UAC, but today I found another one:

The above dialog appeared after I tried creating a new SharePoint Workflow project. After selecting the "Restart" option, Visual Studio closed, I confirmed the UAC Consent dialog and VS then reopened elevated (with the title bar showing its mode) in the same state it was before.

If you find any other examples of actions that result in an elevation prompt in Visual Studio 2008, please drop me a line (other people collect stamps, I collect UAC screenshots).

Labels: ,


 

Regular readers of my blog will know that a requirement (and more importantly good common sense) for your applications that will run on Vista is that they have an embedded manifest declaring their requested privilege for working better with UAC. With Beta 1 of VS2008 I showed how this has become a doddle for C# projects. At the time, there was no such easy option for VB projects.

With Beta 2, VB also gets an easy way to do this. If you find the GUI of the C# approach confusing, then you'll be pleased to find that the VB approach is a single button named View UAC Settings, as per the following screenshot:

Clicking on it adds a pre-populated manifest file to your project which you can optionally further tweak to your liking, of course.

Note that in C#, you can manually add Application Manifest Files yourself:

...and switch between them from the IDE. This does not seem possible from the GUI provided by the VB team.

Further note that this feature is obviously applicable for v2.0, v3.0 and v3.5 client project templates in both languages. My advice to you is to open all your client projects in VS2008 and embed the default manifest now with no further thought. Later you can determine if you need to tweak things...

Labels: ,


Wednesday, August 01, 2007

 

My Beta 2 installation experience was fine and dandy, but yours may not be. If you do face any issues, Aaron shows you how to collect the setup log files for diagnosing.

Labels:


 

If you are facing the error above with Beta 2, it is due to the changes I blogged about. Doug has a nice step-by-step investigation and the solution.

Labels:


 

A few months ago I posted about Office as a development platform with VS2008. While most of the features are easy for you to explore given the screenshots I posted, on my point 6 I only mentioned VBA<->VSTO interop with no further info. If that feature floats your boat (and it certainly will if you have existing VBA investments and would like to extend them with managed code), then go watch this 8' screencast on channel9 (or this soapbox video here).

There is also a great MSDN mag article on VSTO: Extend Your VBA Code With VSTO. It talks about VSTO and VBA interop in this section, and it also touches on ClickOnce deployment in this section.

Finally, relevant to the above, I thought I'd share a new (to me) acronym that I picked up this month: OBA (Office Business Applications).

Labels:


Tuesday, July 31, 2007

 

If you are interested in understanding the relationship of the new C#3 and VB9 features to LINQ, then watch my 20' screencast and let me know there if you have any questions (unlike other videos, I advise you not to speed it up, because I speak very fast as it is ;)).

Labels: ,


Monday, July 30, 2007

 

System.Core.dll (one of the new 3.5 assemblies) has tons of types as you'll recall, so I thought I'd see if anything changed between Beta 1 and Beta 2.

First, do not panic when you open up System.Linq namespace and you do not see the Func delegates. They are still in the assembly but they moved to the System namespace and they also have new friend delegates with various overloads called Action, which are the equivalent of Func but with no return type (all of those changes make perfect sense if you ask me).

The System.Management namespace (with the 20 types inside it) has been renamed to System.Management.Instrumentation. Do not confuse this with the separate, same named assembly that is part of Fx 3.5.

There have also been some small changes to the System.Expressions namespace so revisit your code if you were using those (typically for writing your own LINQ provider).

Finally, the BigInteger is still marked as internal so I personally am giving up hope of seeing it make a come back...

Labels:


 

With Visual Studio 2008 Beta 2 some (good) changes were made to the location and versions of the .NET 3.5 assemblies, which previously were quite inconsistent (two additions were also made and I updated the previous post with those).

The .NET folder under Windows (C:\Windows\Microsoft.NET\Framework\) does not include a build number in its name now, it is just "v3.5" (with Beta 1 it was "v3.5.20404"). If you had explicit references to that location (e.g. in code, config files etc) you will have to change them.

The file versions of the v3.5 assemblies is now 3.5 (that was not the case previously for all of them). They still differ slightly between them on the build number but at least most[1] of them are now in the same place and you can see that in the following partial screenshot of "c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\"


Now with Beta 2, the assembly version numbers are more consistent with each other (and different to the file versions of course). You can see those using your favourite disassembler, or simply via the VS references dialog:


As a reminder, to understand what each one of these assemblies offers, see my blog entry on the green bits.

[1] In the 3rd paragraph above I wrote "mostly" because there is one assembly that is not in that same place: System.DirectoryServices.AccountManagement.dll is one level up in the folder hierarchy (!). So to reference this one you have to browse explicitly to that path from the VS references dialog. Its file version number is consistent with the rest (3.5.20706.1) and its assembly version is 3.5.0.0

Labels:


Sunday, July 29, 2007

 

In my demos you will never find superfluous using statements at the top of code files. When I am trying to explain some new API, I want it to be very clear what namespaces are being used. I have seen many other presenters that leave in there every namespace under the sun and it always annoys me. The other thing I try and do is remove references to assemblies that I am not using (for the same reasons). In fact, I used to do both of these even in real projects; even though there are zero performance implications for either, it just felt cleaner to me.

Now with VS2008 the manual process of removing namespaces is taken care for you. Simply right click in a code file and you see a new option as shown here:


Great! I am not so sure about sorting though. It sorts alphabetically and perhaps that is a good idea now that I think of it, but I am used to sorting my namespaces by length from shortest to longest so a nice triangle is visually formed (yes, I am weird, I know). More seriously, I usually just leave the last namespace I imported appear at the bottom of the list...

The sad thing is that this feature only takes care of using statements and NOT of assembly references as hinted in my opening paragraph. The ironic thing is that while this is a new C#-only feature, in VB (even with VS2005) you can indeed remove unused assembly references from the project properties. If only the two teams talked to each other and both decided to implement the other's complementary feature...

Labels:


 

One of the annoying things on my machine after installing Beta 2 was that my existing Beta 1 solutions would not open by double clicking on them. I could open them from within Visual Studio and I could open project files by double clicking on them, but not sln files created with Beta 1.

If anybody else is facing this, my solution (pun not intended) was to open the solution file in Notepad and change the second line from:
# Visual Studio Codename Orcas
to
# Visual Studio 2008

If only everything was this simple...

Labels:


Saturday, July 28, 2007

 

I noticed a new green assembly has been added to Beta 2 of .NET Framework 3.5: System.Windows.Presentation.dll.

Curiocity got me digging and it appears that it adds some infrastructure support in order for the Managed AddIn Framework (MAF) to work with WPF apps... FYI, also mentioned here.

Labels:


Friday, July 27, 2007

 

Before installing anything these days, I always explicitly run Windows Update. The last thing I want is for an update to kick off in the middle of an install. I encourage you to do the same!

My first attempt to install Beta 2 Professional edition was to be optimistic and install it over Beta 1 on my Vista machine. This dream ended as soon as I run the setup:

So I went to the "Programs and Features" page in control panel and removed "Visual Studio Codename Orcas", which removed a whole bunch of other related things. I then run the setup again and life was good:


After clicking "Install" on the dialog above, the first item that the setup tries to install is .NET Framework 3.5. This took absolute ages on my machine (over 10 minutes). Midway through it was obvious that it had invoked Windows Update because Windows Update gave me the message that it wanted to restart my machine. I thought I'd play it safe (and advise you to do the same) so I selected "Postpone for 4 hours" on that dialog. I then waited and eventually the VS2008 setup informed me that a reboot was required. Of course, I accepted that one. After Vista rebooted the setup continued automatically with no intervention on my part. Apparently, some people (without admin accounts) have to start it manually again so your mileage may vary.

So what was the Windows Update thing that was invoked by the setup, especially since I had manually run windows update before? That is the Service Pack 1 for v2.0 and v3.0 of the .NET Framework (fyi, explanation of red bits). The setup knows where to go and look for them and right now they appear as hotfixes: KB929300 and KB110806.

After that, the rest was as smooth as peanut butter (the smooth variety, not the chunky one).

Labels:


Thursday, July 26, 2007

 

Another LINQ implementation that will ship with Fx 3.5 is LINQ to DataSet (not to be confused with LINQ to SQL).

LINQ to DataSet is about offering a strongly typed in-memory query language for DataSets - it is not for creation of DataSets or for smoothly updating the back end. So, if you are already using DataSets in your applications (inc. mobile applications), keep on reading.

If you tried LINQ to DataSet before Beta 2, then you had to reference System.Data.Entity.dll. This assembly is where the new Entity model lives, which will not ship at the same time as VS2008, but instead will ship soon after. Since LINQ to DataSet will ship with VS2008, its implementation had to be relocated. Its new home is System.Data.DataSetExtensions.dll (and it has a bunch of new types and members compared to the pre-Beta2 implementation!).

In this new assembly you will find a single namespace (System.Data) that contains a total of 9 types. Of these 9 types, 6 are used by the infrastructure and are not intended by direct explicit use by you. I have captured these 6 in this class diagram here. Now, think about what you need in order to use the LINQ syntax with the DataSet... not much really. Since DataSet is an in-memory object, the existing implementation of LINQ to Objects is heavily leveraged. However, in order to make things as friendly as possible, some helper intermediate types are used when we compose our queries and when generating strongly typed datasets – as application developers we don't have to worry about them. These intermediaries is what the previous class diagram shows.

When typing your LINQ queries, you have to sometimes convert from the types that the DataSet uses (e.g. a strongly typed DataTable) to types that LINQ likes using (e.g. IEnumerable). Combine that point with the fact that your queries are likely to be at the DataRow or DataTable level and you realise that what you need is some extension methods to help. That is what the remainder 3 types in the assembly are there for, and you should familiarise yourself with those extension methods to make the best of LINQ to DataSet. Use the following class diagram as food for thought before delving into the code:

For example, calling AsEnumerable on a DataTable makes it fit and compile under the query pattern. For example, calling AsDataView on the results of a query, gives you something you can databind a grid with, make changes and then use for updating the back end (a bit of a roundabout way, but it works). For example, rather than use strings and casting and have to deal with nulls at runtime, you can use Field to do the casting for you and convert to a nullable type. See the following quick example that assumes you have a dataset with data and a datagridview on a form:
var results = 
from o in dataSet1.Tables[0].AsEnumerable()
where o.Field<string>("City" ) == "Hove"
select o;

dataGridView1.DataSource = results.AsDataView();

For more background on LINQ to DataSet, see this 3-part series written on the ADO.NET blog back in February: Part one, part two and part three.

There is also a recorded webcast from May which you can view on-demand here. The first 3 minutes are good for setting the scene of why LINQ-enabling the DataSet is important. The following 17' is a generic intro to LINQ so if you are familiar already feel free to skip. From the 20th to the 40th minute are 3 demos where you can see it in action. I'd suggest stop watching after that (i.e. miss the 4th demo) because the feature it shows is not implemented like that in Beta 2 and later. To get the 3 aforementioned demos, visit Erick's blog (and stay tuned there for updates to the LINQ to DataSet story).

Labels:


 

The moment we've all been waiting for: Visual Studio 2008 Beta 2 hits the streets so get it now

This one has a go-live license associated with it which means that the team are confident about the quality of the product and also about the final feature set. Apparently, you will be able to go smoothly from this version to the RTM version later this year. All changes between this one and the RTM version will be documented, they say. What I can tell you from personal experience is that this build is very solid and has not malfunctioned on me once in the last X days that I've been running it.

You have no reason to wait any longer, go download it and start using it for your existing v2.0/v3.0 projects and later consider taking advantage of the new v3.5 features. Remember, VS2008 has everything in the box :-)

Labels:


Monday, July 23, 2007

 

One of my top 3 favourite features when VS2005 came out was Class Designer (blogged about it 3 years ago). With VS2008, I cannot say there are major enhancements for the Class Designer, but now it is partially supported for C++ projects as well. The team is asking for your feedback so go give it while it's hot.

Labels:


Wednesday, June 20, 2007

 

You know that when you run VS2005 on Vista (even with SP1 and the SP1 update) you get advised to run elevated. You also know that VS2008 has better indication when you run it elevated.

What I haven't explicitly stated before is that VS2008 does not require you to run it elevated from the start. Instead it is a good Vista client and plays nicely with UAC by only prompting you to restart the IDE when you truly need to. For some type of projects this will equate to always run elevated of course, but it is good that it doesn't force this behaviour on all of us and that it offers to do it for you as needed.

Recently I discovered one scenario where it plays nicely. I double clicked on a solution file in explorer and because it was in a place requiring admin rights, I got the following dialog from VS2008


This is cool (even though I suspect the final text will be slightly different as there are a couple of errors there e.g. UAC = User Account Control).­­­­­­­­­­­­­

Labels: ,


Tuesday, June 05, 2007

 

This is a follow up to my previous description of putting VS2008 in context.

.NET Framework (NetFx or Fx) version 3.5 has two elements to it that must be understood: the green bits and the red bits. The original references to this term are on old blog posts by Soma and Jason. Compared to those two blog entries I have the advantage of 13 months of hindsight :-), so I will provide here the details behind those descriptions in my own words starting with my own slide:


When we say red bits, those are Framework bits that exist in RTM today i.e. NetFx v2.0 and NetFx v3.0.

NetFx v3.5 includes updates for those two existing frameworks. However, those updates are not a whole bunch of new features or changes, but in reality a service pack with predominantly bug fixes and perf improvements. So to revisit the terminology: Fx 3.5 includes v2.0 SP1 and v3.0 SP1. Like with all service packs, there should be nothing in there that could break your application. Having said that, if a bug is fixed in the SP and your code was taking advantage of that bug, then your code will break of course. To be absolutely clear, this is an in-place upgrade to v2 and v3, not a side-by-side story at the framework/clr level. I will not focus anymore on the Service Pack (red bits) improvements in Fx 3.5. If you are interested in that you may wish to read my previous blog posts here, here, here and here.

When we say green bits, we mean brand new assemblies with brand new types in them. These are simply adding to the .NET Framework (not changing or removing) just like Fx 3.0 was simply adding to v2.0 without changing existing assemblies and without changing the CLR engine. It is here where you find the brand new stuff to talk about. In Beta 1, the list of new assemblies (green bits) is:

1. System.Data.Linq.dll – The implementation for LINQ to SQL.

2. System.Xml.Linq.dll – The implementation for LINQ to XML.

3. System.AddIn.dll, System.AddIn.Contract.dll – New AddIn (plug-in) model.

4. System.Net.dll – Peer to Peer APIs.

5. System.DirectoryServices.AccountManagement.dll – Wrapper for Active Directory APIs.

6. System.Management.Instrumentation.dll – WMI 2.0 managed provider (combined with System.Management namespace in System.Core.dll).

7. System.WorkflowServices.dll and System.ServiceModel.Web.dll – WF and WCF enhancements (for more on WF + WCF in v3.5 follow links from here).

8. System.Web.Extensions.dll – The implementation for ASP.NET AJAX (for more web enhancements, follow links from here) plus also the implementation of Client Application Services and the three ASP.NET 3.5 controls.

9. System.Core.dll – In addition to the LINQ to Objects implementation, this assembly includes the following: HashSet, TimeZoneInfo, Pipes, ReaderWriteLockSlim, System.Security.*, System.Diagnostics.Eventing.* and System.Diagnostics.PerformanceData.

UPDATE: Beta 2 added two more

10. System.Data.DataSetExtensions.dll – The implementation of LINQ to DataSet.

11. System.Windows.Presentation.dll –WPF support for the System.AddIn mentioned of point 3 above.

12. System.VisualC.STLCLR.dll – STL development in the managed world.

If you decide to "borrow" my slide above, feel free to do the right thing and point people back to this blog post ;-)

Labels:


Monday, June 04, 2007

 

When Visual Studio 2008 (formerly Visual Studio codename "Orcas") ships in FY08, we will also get other elements of the stack. Below is the opening slide I use at Orcas events:

The main points are that the CLR engine is the same version (so no need to retest your apps) and that the headline feature is the language enhancements (C#3 & VB9 compilers) and LINQ.

The VS2008 IDE is not as big a jump as it was when going from VS.NET2003 to VS2005 and it includes all of today's SDKs out of the box and also a simple yet sweet feature: multitargeting inc. the ability to use new language features from .NET 2.0 projects. FYI, I usually do a demo of new IDE features that lasts 15 minutes (inc. aesthetics, VB intellisense, embedding manifests and new Office templates). Given that VS2008 is a superset of VS2005, there is little point in having both of them installed on the same machine, but it is possible – we support side-by-side at the IDE level.

So that is the IDE, languages and CLR in a nutshell. How about .NET Framework v3.5? For that you'll have to see my blog post tomorrow.

Labels:


Sunday, June 03, 2007

 

If you never liked the name of TimeZone2, you'll be pleased to know that in "Orcas" Beta 1 it was renamed to TimeZoneInfo. Having played with this a bit, I found that its members include a dependency on yet another new type: DateTimeOffset. I searched and saw that this has actually been in there for a while.

What I can't fathom is why DateTimeOffset ended up in mscorlib and TimeZoneInfo ended up in System.Core! The latter makes sense, it is a brand new type so it cannot go into existing bits; so why break that rule for the former? To be clear, I would expect both of them to reside in Core. Anyway, regardless of where they belong, go play with them ;)

Labels:


Saturday, June 02, 2007

 

Want to work with VS "Orcas" Beta 1 extensibility points? Get the SDK here.

Labels:


Thursday, May 24, 2007

 

I've had on my TOPLAY list to discover what the "Services" tab is for in the project properties for Orcas client projects. If you don't have Orcas installed and are wondering what's behind the "Advanced" button on that screenshot, it looks like this:


It turns out it is for a new feature, which you can read all about on MSDN, which we are calling "Client Application Services". This will be useful to you if in your smart client applications you want to authenticate users (inc. maintaining different roles and profiles) against a central web store (e.g. with webservices etc) including the ability to work offline once the user settings have been retrieved. It is particularly useful if you are using that central web store already for existing web applications because, as you may have guessed, it leverages the same ASP.NET 2.0 services for authentication, authorisation and personalisation.

The claim is that this Orcas feature makes it "trivial" to create the services on the server-side and to then consume them from the client-side. To see if this claim holds true for you, why not check out the walkthrough by Brad over here, inspired apparently from this one over here (both links include project downloads).

There is also an old webcast on the topic here (you can download the wmv), and I would suggest you skip the first 21 minutes of slides and go straight to the 30' demo.

Labels:


Sunday, May 20, 2007

 

A cute Whidbey feature in the C# 2.0 editor is that when you type in a Type that is not in scope, the IDE will let you choose to automatically either fully qualify the type or to add the appropriate using statement at the top. The editor for the VB8 experience is not that great, as shown by the following side-by-side screenshot:

BTW, for my C# readers, that is not a mistake, VB does allow partial naming of namespaces so since System is in scope, you can simply type Threading.Thread and it is acceptable. A bad habit IMO, I suggest as a guideline that you fully qualify the types starting at the root namespace.

Recently I was typing some VB9 code in "Orcas" and observed that the VB editor has caught up with the C# behaviour (plus it follows my guideline of the previous paragraph), as shown by the following screenshot:

Nice! And just like any other IDE language feature, it is not just for the latest version, but for the previous version as well (thanks to multitargeting).

Labels:


Saturday, May 19, 2007

 

One of the green bit assemblies in .NET Framework 3.5 is System.Data.Linq.dll. As you may have guessed, this assembly contains the framework implementation for LINQ to SQL. Regular readers will know about my other multiple LINQ posts, but I have never posted about LINQ to SQL (formerly known as DLinq).

So, if you are interested in DLINQ, stay tuned on a series of posts that ScottGu has started here. For a detailed LINQ to SQL tutorial series of videos, check out the output from our local nugget machine (aka MikeT). I have captured here the direct links to the WMVs for the 18 screencasts: Intro, DataContext, Mapping, Tools, Inserting Data, Deleting Data, Updates, Concurrency, Joins, NULLs, Deferred Query Execution, Deferred Loading, Stored Procedures (querying), Stored Procedures (updates), Standard Functions, Custom Functions, Inheritance, Transactions.

Labels: ,


Wednesday, May 16, 2007

 

Oh, how happy I was when Orcas started using the Vista CommonFileDialog. Oh, how pissed off I get when applications on Vista still use the old legacy dialog. One of the applications I use a lot is Reflector and for a while I've been nagging Lutz on IM and email to make Reflector use the new OpenFileDialog, but nothing came of my harassment. Until recently when I noticed that Reflector indeed started showing me the new dialog so I thanked Lutz for finally listening. His reply was that he wasn't aware of it and he had changed nothing other than it now forces it to run against 2.0.50727 using a config file. That put me on a hunt!

The result of the hunt was that with the "Orcas" update of v2.0.50727 (remember how I explained this a few hours ago) the System.Windows.Forms.OpenFileDialog has had an internal implementation change that makes it detect if it is on Vista and puts the correct dialog up, rather than the legacy one (on a legacy OS like XP, it will show the old dialog of course). Using reflector, the place to look is FileDialog.RunDialogVista called by FileDialog.RunDialog which is called by CommonDialog.ShowDialog. Great news!

So I then wanted to see if the WPF version has also been updated, in which case half of VistaBridge would be obsolete (the TaskDialog half would still be useful of course). Unfortunately, the WPF version of OpenFileDialog (residing in Microsoft.Win32 namespace in the PresentationFramework.dll) has not been updated. I am confident that it will happen by RTM, but in the meantime from your WPF projects you can reference the System.Windows.Forms.dll and use its Open/SaveFileDialog instead.

Labels: ,


Tuesday, May 15, 2007

 

One of the namespaces in the new System.Core.dll is System.Diagnostics.PerformanceData. It is a set of classes that wrap a new set of performance counter APIs (in Advapi32.dll) that are applicable only to Vista and higher. Here is a class diagram followed by an explanation:

Rather than actual code, here are the steps for working with the set of classes above.
1. Create a CounterSet object specifying the CounterSetInstanceType
2. On this instance, call AddCounter specifying an integer id and a CounterType (plus optionally a name) [repeat this step as desired]
3. Once done repeating step 2, call CreateCounterSetInstance to obtain a CounterSetInstance object.
4. On the object of step 3, via its Counters property get an instance of the collection object: CounterSetInstanceCounterDataSet
5. From this collection, retireve the CounterData objects either via the integer id or by name
6. Only one long Value property on the CounterData objects to tell you what you are after

In case you are wondering, step 1 above wraps PerfStartProvider and step 3 wraps three APIs in sequence: PerfSetCounterSetInfo, PerfCreateInstance and PerfSetCounterRefValue. If you look at the native signatures and the "cute" structures they expect you to setup, then you'll realise why it has been wrapped for us :-)

Labels: ,


 

One of the new assemblies in .NET Framework 3.5 is System.DirectoryServices.AccountManagement.dll (you have to browse on the file system to your Framework 3.5 installation in order to add a reference in VS "Orcas"). It is an extensible managed wrapper with intuitive search that aims to simplify programming with both ADAM and AD – it is based on SDS/ADSI under the hood. I deduced that from a powerpoint deck that you can find in a zip file if you scroll to the bottom of Joe's blog post there (look at slides 18-22, includes code snippets).

I started looking at it and like I always do with new namespaces I drew a class diagram to help me understand it. It turned out to be fairly large so only if you are really interested, have a look here. Better still, for a small piece of sample code, go to Bart's blog post.

Labels:


Sunday, May 13, 2007

 

For the importance and context of this blog entry, please DO read my previous blog post including the disclaimer at the top.

The feature I have not explicitly addressed yet is extension methods. If you are a C# developer that has been using the "magic" this keyword read my explanation to understand what we are talking about here. You see, even though extension methods are a compiler trick, they do rely on the new System.Runtime.CompilerServices.ExtensionAttribute introduced in System.Core.dll. Since we've already established that System.Core is a Fx v3.5 assembly and hence is not usable from 2.0 projects, you might think this is the end of the road for extension method usage in 2.0 projects. Let's explore this further.

In a 2.0 Orcas project try and compile the following code:
static class Program
{
//[ExtensionAttribute()]
static void DisplayInterval(this Timer t)
{
Console.WriteLine(t.Interval.ToString());
}

static void Main(string[] args)
{
System.Timers.Timer t = new System.Timers.Timer(2000);

Program.DisplayInterval(t); // long hand usage of method
t.DisplayInterval(); // short hand usage of method (extension)

Console.ReadLine();
}
}
You will see a compiler error as follows:
"Cannot use 'this' modifier on first parameter of method declaration without a reference to System.Core.dll. Add a reference to System.Core.dll or remove 'this' modifier from the method declaration"
What the compiler *really* wants to say is:
"You are using the 'this' modifier and it depends on the ExtensionAttribute that itself resides in the System.Core.dll and you do not have a reference to it"
Once you understand what it is really saying, and once you realise that it only needs this attribute at compile time (since at runtime the IL to be interpreted will still include the call to the utility method in long hand), then it all becomes clear what you need to do next. Declare the attribute yourself! It isn't such a big logical jump (or else I wouldn't have made it :-))

So add to your 2.0 project a new empty code file and paste in it the following code:
namespace System.Runtime.CompilerServices
{
public class ExtensionAttribute : Attribute { }
}
Then, wherever you declare the extension methods, optionally add to the top:
using System.Runtime.CompilerServices;
Now your projects will compile and you can use extension methods!

So summing up the previous post and this one, all 6 language features behind LINQ are usable from Fx v2.0 projects. But the LINQ to objects/xml/data implementations clearly are not usable because they live in Fx 3.5 assemblies. You can of course offer your own LINQ implementations for your own data sources. For example, the following code will compile in a Fx 2.0 project...
using Moth.Linq;
static class Program
{
static void Main(string[] args)
{
var ints = new []{1,2,3,4};
var res2 = from p in ints
where p > 2
select p;

System.Diagnostics.Debugger.Break();
// examine res2
Console.ReadLine();
}
}
...if you also add to the project this (demo) code file here.


BTW, how soon are you guys out there planning to move your existing 2.0 projects to Visual Studio "Orcas"? ;-)

Labels: ,


 

Please note that this and my next post are based on Beta 1 Orcas bits. Later builds might change the facts so always try it yourselves.

There still appears to be some confusion with regards to the new language features that make LINQ to objects work. In particular, there are claims that it all works with .NET 2.0 and counterclaims that it doesn't. IMO the confusion arises from people not being precise about what they are talking about. I'll try and give you here my view (which of course I think is as clear as can get :-))

To start with, everything here is in the context of Visual Studio "Orcas" – forget earlier versions. Orcas supports multitargeting so you can build projects that target .NET Framework v2.0. So the real question we are addressing here is whether you can choose to build a NetFx 2.0 project that also uses some of the new C#3 language features.

If you are not familiar with LINQ, please go read my detailed LINQ blog posts and then come back. So after reading about LINQ I hope you realise that:
LINQ =
1. local variable inference +
2. object intiliazers +
3. anonymous types +
4. lambda expressions +
5. extension methods +
6. query expressions +
7. framework support.

Let's look at some of the language features. The first 4 do work with 2.0 projects i.e. the following compiles and runs fine in a 2.0 Orcas project:
class Program
{
delegate T Func(T t);
static void Main(string[] args)
{
// object init -
// makes no sense in this example but hey...
Timer t = new Timer(2000)
{
AutoReset = false,
Enabled = true
};

// local var inf, anonymous types
var i = new { Name = "Fred", Age = 6 };
Console.WriteLine(i.ToString());

// lambdas
Func f = j => j + 1;
Console.WriteLine(f(5));

Console.ReadLine();
}
}
Can you spot them? Local variable type inference, object initiliazers, lambda expressions and anonymous types. This shouldn't surprise you if you read my previous blog posts since I have stated clearly many times that these language features are simply compiler tricks. The IL that gets generated is the same old IL – no dependency on the framework and no dependency on the runtime. So 2.0 projects in Orcas can use 4 of the smart compiler tricks, this is good! As an aside, other 3.0 compiler features irrelevant to LINQ such as automatic properties, also work in 2.0 projects.

On the gloomy side, it goes without saying that number 7 above, the "framework support", resides in System.Core.dll and you cannot reference that assembly from 2.0 projects, so no extension method implementations for you in 2.0 projects. If at this point we think of number 6 above, "query expressions" (i.e. from...where...select syntax), we realise that their usefulness is in friendly mapping to the extension method implementations in System.Core.dll (or System.Xml.Linq or Systam.Data.Linq or your own extension method implementations). So even though query expressions are supported when targeting v2.0 projects from VS "Orcas" (the syntax highlighting when you try it is a clue) there is no implementation to map them onto - other than your own. Well, even your "own implementation" implies that you can use Extension methods for v2.0 projects and I haven't addressed that yet (number 5 above). See my next post now.

Labels: ,


Friday, May 11, 2007

 

Part of .NET Framework 3.5 is a new framework assembly: System.Xml.Linq dll. Now, I know most people describe this in the context of LINQ (it used to be called XLinq) and indeed it works very well with LINQ but I wanted to stress here that effectively this is a standalone new XML API. You can use it without ever going anywhere near the LINQ syntax.

There are 3 namespaces inside the assembly the main one being System.Xml.Linq with 23 types, the most important shown below:

The ones you are most likely to use all the time are XElement and XAttribute (I bet you thought I'd say XDocument but actually you don't really have to use that one!). So why yet another new API for XML? Because this one is really cool! One aspect of the coolness is the way you create XML documents/fragments: You can do that in a single statement where the creation of XML items and their association takes place in the same step! Also while writing that single step/statement, you get to do it in the natural way that you think of the layout of the XML document. For example, in the following screenshot I have captured the code and the document it creates side by side. Can you see how intuitive it is?

Another aspect of the coolness of the API is that you can indeed use it with the LINQ syntax both for creation and for querying. To assist with that there are a bunch of extension methods in 3 static classes: System.Xml.Linq.Extensions, System.Xml.Schema.Extensions and System.Xml.XPath.Extensions. FYI, there are no other types in the Schema and XPath namespaces. I'll let you explore that yourself in the Beta 1 of Orcas.

The coolest thing about this API however is only available to Visual Basic developers. The VB compiler is smart enough to let you type in XML literals while it produces the necessary calls to the new XML classes. The code I showed above in C# 3.0 can be written in VB9 as per the following:

To see more about creating the documents, how LINQ syntax can be thrown in and how VB syntax with XML truly rocks you need some nuggets of course. Well, my colleague beat me to it so I encourage you to view his videos here (he is a bit behind the times using the March CTP so note that adding a reference to System.Core and System.Xml.Linq is done for you in Beta 1 for 3.5 projects).

Labels: ,


 

I have talked about and screenshoted multitargeting before in Orcas. When you create a new 2.0 or 3.0 project, features that are in v3.5 will not be available in your toolbox or properties or the references dialog. What I hadn't realised until today was that you can still see them even though they are not available, which I think is cool. Notice in the following screenshot how System.Core.dll is greyed out in my 2.0 project references dialog.

If you create a project and then change the framework you target to be a lower version than what it was before, you will get compiler errors for anything that isn't present, of course.

Labels:


Thursday, April 26, 2007

 

Recently I repaved my Toshiba M5 starting from scratch (format, Vista RTM, join domain etc). The way this works for me is that I have a secondary drive in the laptop with all my data plus apps (multiple msi files, setup.exe files, iso images etc). I install the OS on the main drive and then continue to install the other applications from the 2nd drive. Looking at my instructions (I've written a simple installation todo.txt file that reminds me of what to do), I used to install the following for my mobile development needs: VS2005, SP1, SP1 Update for Vista, Latest NETCF SP, WM5 PPC SDK, WM5 SP SDK, DE v2. I am sure this isn't the story for device development only, but that every developer has their own set of things they install on top of VS e.g. WF Extensions, WPF/WCF extensions, VSTO SE, AJAX, MOSS SDK etc - overall a dozen or more separate installation packages (separate to install, separate to maintain/keep).

With the advent of Orcas Beta 1, I decided to ditch VS2005 completely and only install Orcas as my sole dev environment (btw, without multitargeting this decision would not be possible). It is only then that I truly realised that I do not need *any* of the above extras/extensions/SDKs since they *all* ship in the box as part of the single installation! :-)

The side benefit of this is that, previously if you had no interest in some technology (e.g. Office development or web development or device development) you probably wouldn't bother installing something separate, but now the story is different: it is just there so you can have a quick play with it whenever you want and ignore it thereafter if you still don't fancy it.

What will YOU install the next time you repave your machine: VS2005 side-by-side with Orcas or just Orcas?

Labels:


Tuesday, April 24, 2007

 

While no doubt everyone will be talking about VB intellisense that I’ve mentioned before or the Javascript intelisense, I just discovered another small improvement in the Orcas IDE.

You will recall that VS2005 introduced DataTips (debugger tooltips on steroids) and when you hold down the Ctrl key they become transparent. Well, that is now true as of Beta 1 for the intellisense window too! In the screenshot below, the left side is what you would face today but with Orcas Beta 1 hold down the Ctrl key and you can see what is below the intellisense window without having to close it, as shown on the right:


I wonder how many people will discover that. It reminds me of another little known feature introduced in VS2005, which I still encounter people today not knowing about: ability to resize the intellisense window... try it if you haven't!

Labels:


Sunday, April 22, 2007

 

At this year's UK MSDN roadshow day (btw, next one is this Wednesday 25th) we have five 70' session slots. MikeT shared our reasoning for including a 10' office bit at the end of each core 60' session. Most of the people that I spoke to said that before the event they didn't care about Office development but after seeing how easy it is to do and realising the benefits, they have more of an open mind now. Given that it seems not so easy to find information on Office development, Martin did a great job pulling together starting points. Go check them out!

In "Orcas" the Office story gets even better:
0. Office 2003 and 2007 development out of the box. No need to download a separate VSTO (SE) SDK.

1. New project types. Now you can create out of the box add-ins at the document/template level, rather than just the global application level only. Feast your eyes on these project templates:

For Office 2003 project templates, see this screenshot.

2. Ribbon designer. No more manual authoring of XML, just drag and drop ribbon controls into groups on tabs, set properties and you are done (the familiar winforms paradigm).

In the image above you see properties for the button, but you can also tweak properties (and handle events) for the other ribbon elements (i.e. tab, group) including the ribbon itself such as its OnLoad event! If you right click on the ribbon in the designer you get the option to generate the XML (and cs) file - attendees of my roadshow session know XML was the only approach available with VSTO SE:


3. To customise the ribbon for any of the 2007 Office applications you have to select the appropriate item template from the Add New Item dialog:

If you created an Outlook project, as you can see the dialog above also offers the Form Region option. That's right, support for Outlook 2007 Form Regions is now available via Windows Forms controls (no more manual messing with OFS files) and the wizard even offers the option to import existing projects (this last option is not functioning yet in Beta 1):

Click for screenshots of STEP 2 and of STEP 3.

4. From the first screenshot of this blog post you saw that we can create document and template level projects for Excel and Word. Picking any of those leads you to a dialog similar to this:

After that you can add new document level Actions Pane items (don't confuse with Custom Task Pane which works at the application level and is just a UserControl):

Specifically for Word projects, in design mode in VS you can add to Word's surface (and even databind!) Content Controls:


5. Even though all of the above is Office client-side, under the Office banner we include the server-side technology SharePoint. Authoring workflows for SharePoint in VS2005 involves a 15-step configuration process (which some of you will have seen me perform for the UK developer launch of Office in January :-)). In "Orcas", you simply design the workflow and hit F5 including easy debugging. The complex stuff is taken care of by a wizard, whose first step you can see here:


6. Naturally I don't have teaser screenshots for every Orcas Office feature so I leave it to you to discover the interoperability between VSTO/VBA (i.e. call the former from the latter), support for the new Office file format and ClickOnce improvements...

In short, with VS Orcas and Office 2007, I am finally beginning to see the meat in the phrase: "Office as a development platform"...

In addition to the links at the top, you may find interesting these Office blogs here, here, here, here, here and here.

Labels:


Friday, April 20, 2007

 

From the first time I typed Visual Basic code in Orcas I've had on my list to do a short video to show the new and improved intellisense because only video can do it justice. Since Amanda let the cat out of the bag by posting some screenshots, I am left with no choice but to share even more of the intellisense story with you :-)

Basically, it is everywhere. When you start typing "D" to declare/dimension a variable, it will pop up:

...when you then continue to declare the type of the variable, it will help you again:

...it comes into its own with the new LINQ syntax:

...and at the end of code line, when you press the spacebar, it will even prompt you for the continuation line:


You just have to go type some VB code in Orcas to truly appreciate how helpful it is. However, the killer for me is what I will refer to as "member filtering" as I have no idea what the official name is. With this feature, after hitting the dot (".") on a class variable and as you type, the intellisense window filters down to the more appropriate member. See the following 3 screen captures that I combined into one screenshot image:



In the example above, first we have the list of all members of the Process class, then after typing "p" the list gets filtered down to only members starting with p and then finally when we type "ro" the list goes down to just the two members starting with "pro". If I continued typing when I reached "n" in "ProcessN" I would have been left with just one member.

And all this great intellisense is of course also available when targeting .NET 2.0 projects (minus the LINQ stuff) due to the Orcas multi-targeting.

Labels:


 

After installing Beta 1 on my Vista machine, I found that the look and feel of things I previously blogged about had changed for the better.

* Ctlr+Tab got a facelift. For previous screenshot and the new one see my updated blog post: Ctrl+Tab in Orcas.

* The ability to target multiple framework versions from a single IDE is still there but now it is more obvious (they must have heard my winging :-)). Check out my updated post on Multi-targeting.

* For Smart Device Projects, I complained about the combobox not remembering the selection and now that is fixed. The VSD team also added a bonus feature in this release. Check out my updated post on the new Project Dialog.

* Like in previous builds, we have nice rounded selections in the menus...

...if you complete the action of the screenshot above, you will of course get this dialog. Notice how the treeview under Project Types displays no plus/minus for expanding/collapsing the nodes? If however you hover the mouse on the treeview then new triangle expandos appear as per the following screenshot:

For more on what is going on here read my post on TreeView Vista (basically the VS team put in the extra effort to spice this up on Vista :-)).

Labels:


Thursday, April 19, 2007

 

Visual Studio codename "Orcas" (and NetFx 3.5, C# 3, VB9) has reached Beta 1.

The huge VSTS VPC image is available right now here and other SKUs will follow. You can even get the lightweight Express SKUs here and the TFS Server here. Personally, I'd wait a bit longer for the installable bits of the Pro Edition which for the first time is even supported on Vista :-)

As always the feed that tells you these things is worth subscribing to over here.

Labels:


Wednesday, March 28, 2007

 

My colleague MikeO looks after the web space here in the UK and he started a list of what is new in Orcas here.

Inspired by his list I searched the blogosphere (yeah that word makes me cringe too...) and found more on the three things that caught my eye:
1. Script intellisense (here)
2. New web form designer (here)
3. Better CSS support (here)

If you are a web dev, stay tuned for more Orcas goodness by following those 4 blogs above...

Of course other generic aspects of Orcas apply equally to the web story such as multi-targetting and LINQ.

Labels:


Monday, March 19, 2007

 

In the "Orcas" framework, another green assembly is the System.Net.dll that contains all the new PeerToPeer classes (spread over 3 namespaces: System.Net, System.Net.PeerToPeer and System.Net.PeerToPeer.Collaboration). I saw a nice demo of this by the dev on the team back at TechReady3. In terms of explaining the library, once again the product team are "getting in there" first, so no point duplicating what they have already written. Check out the first post and stay tuned on the p2p blog for more... I've captured a class diagram of 3 key classes here for my future reference...

Labels:


Saturday, March 17, 2007

 

Some blogs have reported that there are performance improvements in the Garbage Collector that ships with Orcas. That is slightly inaccurate. What is new is the ability to have finer control over the GC, including the ability to suggest to it that it should not run during the execution of a time critical phase (e.g. code block) of your choice (I know some guys that would love that in the .NET Compact Framework but this is a full framework feature only).

I was going to do a proper write up on the additions (1 method, 1 property and 1 enumeration) but Chris beat me to it and, given that he officially tests the feature, he certainly knows a lot more about it than me so go read about the new GC collection modes here and the new GC latency modes here.

Labels:


Wednesday, March 14, 2007

 

If you are not familiar with the new Event Tracing for Windows in Vista then read this article. You'll then no doubt be asking yourself "what about access from managed code?". For the answer, go read this blog post.

Labels:


 

I was going to point to the new crypto algorithms on Shawn's blog, but actually if security floats your boat, just read his entire Orcas category.

If you prefer exploring these things directly in Visual Studio look at the classes in the System.Security.Cryptography namespace in Core.

Labels:


Saturday, March 10, 2007

 

The point of this post is: do not install the Orcas March CTP side by side with VS2005 on Windows Vista.

This CTP is not meant to be installed directly on Windows Vista. It can happily be used in a VPC on Vista and it is also meant to be installed directly on XPSP2 or WS2K3. Given that Virtual PC 2007 is now free and is supported on Vista, just install it in there or grab the VPC image already built for you. You'll love it. Obviously the final version of Orcas will be supported directly on Vista and indeed so is the plan for the next Orcas drop whenever that comes. Furthermore, the final version of Orcas will side-by-side with VS2005 and while this March CTP does side-by-side, it does have some issues so, again, I would not recommend the side by side thing yet.

Now, given what I just said, you won't be wrong to call me a "fool" for actually installing Orcas on my Vista machine to side by side with my VS2005 installation. This has caused me at least 3 issues:
1. Getting NETCF installed needed some manual help from me, my device forms do not render in the designer and I also had some WM5 SDK conflict issues. If you are not doing device development, these won't affect you of course.
2. My existing installation of Visual Studio 2005 Tools for Office Second Edition broke by the Orcas install e.g. my VS2005 excel add-in projects fail with weird compile errors. I fixed this by repairing the VSTO 2005 SE installation.
3. My Orcas properties grid is broken.
4. I haven't had this issue but others have: "Orcas" Web applications fail on Vista.

On the flip side, all my LINQ demos work great!

Once again, best option is to use the VPC image in our free VPC2007 software. Equally good option is that you install it yourself on a non-Vista machine without VS2005. Remember, it *is* a Community Technology Preview!

Labels:


Thursday, March 08, 2007

 

At a recent event where I was presenting on LINQ, I showed a query with a join, similar to the following:
      var results =
from p in Process.GetProcesses()
join p2 in MyProccess.GetMyProcList()
on p.ProcessName equals p2.MyProcName
where p.Threads.Count > 14
orderby p.ProcessName descending
select new { p2.MyProcDescription, ThreadCount = p.Threads.Count, p.Id };
After the session one of the delegates asked me: "Why do we have to use the equals keyword and not just ==". In other words he would have preferred to type:
on p.ProcessName == p2.MyProcName
I didn't have a good answer but promised to look into it.

Looking into it involved pinging the product team and Matt Warren (C# software architect) came up with the reply, which I include unedited, warts and all :-)
"The reason C# has the word ‘equals’ instead of the ‘==’ operator was to make it clear that the ‘on’ clause needs you to supply two separate expressions that are compared for equality not a single predicate expression. The from-join pattern maps to the Enumerable.Join() standard query operator that specifies two separate delegates that are used to compute values that can then be compared. It needs them as separate delegates in order to build a lookup table with one and probe into the lookup table with the other. A full query processor like SQL is free to examine a single predicate expression and choose how it is going to process it. Yet, to make LINQ operate similar to SQL would require that the join condition be always specified as an expression tree, a significant overhead for the simple in-memory object case."
Makes sense!

UPDATE: Vladimir Sadov from the Visual Basic team told me that VB also uses Equals for pretty much the same reasons.

Labels: ,


Tuesday, March 06, 2007

 

UPDATE: After Beta 1 I updated the screenshot below (you can still view the old one here).

As you know, Orcas is the codename for both the next version of Visual Studio and the next version of the .net framework (v3.5). The great news is, that VS "Orcas" not only lets you create projects that target v3.5 but it can also target v3.0 and v2.0 as the following screenshot shows:


If you pick the wrong template (which I am guessing many will since the version dropdown is in a non-obvious place IMO), then you can change the platform later via the project properties under the Application tab:

In VB, the option to change it later is via the Advanced Compile Options under the Compile tab.


Some will say "at last", all I can say is... "Cool!"

Labels:


 

The first thing you should do with your applications on Windows Vista (and indeed a logo certification requirement) is embed a manifest in your application that effectively tells Windows that your app is aware of User Account Control. I have explained how to do this with VS2005 here. Also Catherine listed a few ways here. Bottom line: create a manifest like this, and embed it in your project with a post-build command: "$(DevEnvDir)..\..\Common7\Tools\Bin\mt.exe" -manifest "$(ProjectDir)$(TargetName).exe.manifest" –outputresource:"$(TargetDir)$(TargetFileName)";#1

In VS Orcas C# projects, life becomes slightly easier. Effectively, there is a combobox under the Application tab in the project properties that allows you to point to a manifest and then it will embed it in the application. I cannot find this option in VB projects yet.

To me, there isn't much difference between pasting the command line from further above in the post build box and instead choosing a combobox item. However the latter does have the advantage of being more discoverable :-)

UPDATE: FYI, I got the below from Saurabh Jain (a dev on the team responsible) with regards to the March CTP:
"There is more support for manifests then you might see.

Firstly, the compilers have new switches for manifest, so there is no post build event.

C:\>csc.exe /? | findstr -i man
/win32manifest:<file>   Specify a Win32 manifest file (.xml)
/nowin32manifest        Do not include the default Win32 manifest
Secondly, if you have a .manifest file in your project, that file will appear in the dropdown. You can then select the file, and it will be passed to compiler. This is how one can add a custom manifest file."

Labels: ,


Copyright © Daniel Moth