Friday, March 21, 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:


 

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:


Tuesday, November 20, 2007

 

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:


Monday, October 22, 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:


Friday, August 24, 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:


Monday, August 20, 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:


Sunday, August 19, 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:


 

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:


Thursday, August 16, 2007

 

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: ,


 

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:


Tuesday, August 14, 2007

 

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)