Sunday, February 24, 2008

Webcast: New Enhancements for Web Developers in VS 2008

 

Wanted to update you on a upcoming web cast that I am doing in support of Visual Studio 2008 launch event...

Title: New Enhancements for Web Developers in VS 2008

Date/Day: Tuesday, February 26th 2008

Time: 11am to 12:30pm Pacific Standard Time (PST)

Description :Get an overview of how Visual Studio 2008 takes web development to the next level. See highlights of the key new Web tools experiences in the Visual Studio 2008 product including support for multi-Targeting,  JavaScript enhancements, rich support for CSS standards, rapid development of data-bound web pages using LINQ To SQL, and more. Also learn about the new Web Application Project and Web Deployment Project enhancements to Visual Studio which adds an alternative Web application development, build and deployment models to the Visual Studio project system.  Also have a sneak preview of the work being done for Web Developers in out of band releases like ASP.NET MVC Framework.

Registration URL:

http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032369517&Culture=en-US

Hoping you will be able to join!!

Tuesday, February 19, 2008

Free Microsoft Software for Students

Microsoft announced an unparallel program called "Microsoft Dreamspark which will offer free Microsoft Visual Studio 2008, Microsoft Expression Studio and Windows Server 2008 free to students...

You can read more about this announcement at http://channel8.msdn.com/Posts/2047/

Enjoy!!

Monday, February 18, 2008

ASP.NET MVC Test Framework Integration

Previously I gave an overview  of new tooling features for ASP.NET MVC Framework that we are hoping to make available during MIX 2008 timeframe.  You can read more about Overview of MVC Tooling Features for MIX 2008 here

Goals: ASP.NET MVC Framework is Microsoft's implementation of MVC framework which is hugely popular in the industry for best practices and conventions.  In lines with best practices one of the goals of this new ASP.NET framework is to enable easy unit testable web applications.  To ease unit testing and to make it part of our regular application development workflow Visual Studio is introducing integration of unit test projects with ASP.NET MVC Application.  Many in the community are already familiar with and are using test frameworks liked Visual Studio Unit Test, NUnit, MBUnit etc.  If you have Visual Studio Unit Test framework on your machine (i.e. in Visual Studio 2008 SKUs Professional and Above) then on creation of ASP.NET MVC Web Application you will automatically be prompted to create a test project.   Not only that, due to the popular community request Visual Studio will now also provide a mechanism to extend this test framework system to integrate external unit testing frameworks like NUnit, MBUnit, xUnit etc.

Today I will be walking you through this new Test Framework integration for MVC Projects. Our goal today is:

  • To understand how to create test project templates
  • To understand how registration works for test project framework and how to register a custom test project template

At the end we want to get to a point where your test framework of choice shows up in the drop down when you try to create a MVC Application (like 'NUnit' does in the figure below):

(Fig 1: Create Test Project Dialog Box)

Applies To:  This article applies to Visual Studio 2008 with ASP.NET MVC Framework Mix 2008 CTP installed.  This documentation is pre-release documentation intended to provide insights to the community on the work being done by MS on ASP.NET MVC Framework, we are still in development phase so please do note that this is subject to change, but we believe this is very close to what you can see during MIX timeframe.

Video:  I have also created a screen cast (approx 30 mins in length) which covers the concepts of this post in detail, we will be making it available here soon...

Step 1: Creating Test Project Templates : There is a very succinct article on MSDN on how to create Project Templates.    You can find this article at http://msdn2.microsoft.com/en-us/library/s365byhx.aspx.  Although the process may vary depending on the type of unit test framework and mock objects you choose, I am summarizing the process in context of MVC Test Project Template which I created using NUnit framework and Rhino Mocks library.

  • Create a new class library project with the Code Language of your choice, give it a good reusable name which will apply to your test project template.
  • Add reference to "System.Web.MVC", "System.Web.Abstractions" and "System.Web.Routing" dlls in your class library project.  These DLLs will ship along with ASP.NET MVC Framework in the MIX 2008 CTP.
  • Download required Test frameworks (NUnit, MBUnit etc)
  • Download required Mock object libraries (Rhino mocks, Type mocks etc)
  • In the class library project add the right references to to the test framework and mock objects which you want to use.
  • Make sure that you make all of the above references dll's  "Copy Local" property to "True" (Select the referenced DLL and hit F4 to access the property in the Property Grid)
  • Add required folders and classes to test an MVC Application.  You can pre-populate whatever tests you like, but at the minimum if you would recommend matching the default MVC Application template that ASP.NET MVC Framework will ship with.  In order to match the default application template use the following structure:
    1. Create a "Controller" folder under the project root and add "HomeControllerTests" class to it.  Add unit tests to cover "About" and "Index" actions
    2. Create a "Routes" folder under the project root and add "RouteTests" class to it.  Add unit tests to cover the two default routes that will come with ASP.NET MVC Framework.
  • Build your project so that the required binaries are present in the bin (note: my screen cast has this step missing and hence I get some unresolved references when I instantiate the template)
  • Go to File-->Export Template wizard and follow its easy directions.  The project template is usually created in the user's VS directory (the wizard will point you to the location).
  • Remove the template.zip from the user specific directory and move it to %Program Files%\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\Language\Test\Locale
  • Close all the instances of Visual Studio and open the command prompt (Start --> Run type cmd)
  • Navigate to the IDE folder on the command prompt (cd %Program Files%\Microsoft Visual Studio 9.0\Common7\IDE) and type devenv /setup, hit enter
  • This will take some time but should setup your newly created project template within Visual Studio .  If you now open VS 08, then in New Project dialog box you should be able to see your template show up under C#/VB-->Test directory.

Step 2: Understanding Test Project Registration: We are introducing a very easy registry based registration model for your test project templates.  Please refer the registry structure below:

image

(Fig 2: Test Framework Registry Info)

We have a new MVC key under Visual Studio 9.0 registry location as highlighted above.  As you can see above I have NUnit and VisualStudio as my available test frameworks.  This is what is showing up in the  screen shot of "Create Test Project" dialog box in Fig 1 above.  If you would like to add more test frameworks please go ahead and create one more key under 'TestProjectTemplates' key.

On the right side you see various string values, let me go ahead and explain what each one of these mean:

  • AdditionalInfo:  You can enter a URL for more information on the Test Framework here.  It is hopefully going to be used by 3rd parties who will be creating Test Project Templates.  This link shows in the Fig 1 as "AdditionalInfo" link
  • Package:  This is a pointer to the VS package that you may want to use in case you are adding UI elements or doing advanced functionality with your Test Project.  Visual Studio will be using this information to pull out localized resources when we localize MVC Test Project Template for Visual Studio
  • Path:  The Test Framework selection of VS expects that your test templates are registered with Visual Studio and are located some place under standard VS Project Templates location (i.e. %Program Files%\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\. The Path value mentioned here is actually the location under this standard VS Project Templates path. 
  • Template:  This is the actual zip file name which was created in the Step1 above.
  • TestFrameworkName: This is the name that will show up in the drop down of Fig1: above.  In order to localize the URL of AdditionalInfo or name of TestFrameworkName we will provide a special syntax like "#1209:NUnit".  This will indicate to Visual Studio to use resource # 1209 from the Package above for the localized string but if nothing is available then use the default "NUnit".

Also one point to note over here is that VS Test Framework selection system will create a test project for the same language as your primary MVC Application Project. The same registry strings that we just discussed above can be replicated at the top node (e.g. 'VisualStudio') that I have highlighted in the Fig 2 above.  I would recommend having that replicated as it allows Visual Studio to fall back on this template in case your primary MVC Application is of languages  like 'IronPython' etc.  In nutshell that is the default template for that particular test framework within VS.

Summary: On completing the steps above, when you go to File--> New Project --> Language --> Web and try to create a new "ASP.NET MVC Web Application" project then the dialog box presented in Fig1: will show up with your newly registered Test Framework in the drop down. 

Hope this will get you unit testing your projects more and more...!!

Vishal R. Joshi | Program Manager | Visual Studio Web Developer

Sunday, February 17, 2008

Tooling Features Overview of ASP.NET MVC Framework for MIX 2008

There has been a tremendous positive response on ASP.NET MVC Framework from the community since we released the December 2007 CTP of ASP.NET Extensions.  With MIX 2008 coming closer our teams have been super busy in trying to bring out value additions to ASP.NET MVC Framework.  ScottGu, in his ASP.NET MVC Road-map post, recently introduced the new MVC features coming up with MIX preview.  He had mentioned that with this MIX release ASP.NET MVC will get much better Visual Studio 2008 integration and support.  My post today is to outline these integration points and support within Visual Studio.

Features:  During December 2007 preview of MVC we just had project templates to support MVC development within Visual Studio, since then there have been some improvements which are as below:

Project Template Filtering and Naming: MVC Project templates will now be filtered based on .NET Framework version and will be available only when you select Framework version 3.5.  You can now also name your projects and solutions as per your choice which was not possible in the Dec 2007 CTP.

Test Framework Options: In Dec 2007 CTP we had 'MVC Application' project template and also had 'MVC Application and Test' project template.  We now do not expose the 'MVC Application and Test' project template instead we have a cool new Test Framework options dialog which shows up as soon as you click okay on you MVC Application creation.  This test framework dialog assumes that you want to create your test project in the same language as your primary MVC Application and so it does not show you that option.  TheTest Framework dialog box will look like below:

image

When you select your Test framework and click okay Visual Studio will create a multi-Project template with the Test Project already having reference to your primary MVC Application.  In my follow up post on this topic will learn about the way 'Test Framework Options' dialog box works behind the scenes and understand the way by which we can extend it to use external 3rd party testing frameworks.

'Add New Items' Dialog Box:   The new 'Add New Item' dialog box for MVC Applications will show a "MVC" node under the "Web" node as shown below.  This will allow you to locate your MVC item templates pretty easily:

image

ASP.NET MVC framework (without any extensibility customizations) requires you to suffix your controller names with "Controller".  Visual Studio will now help you achieve this mundane task by reminding you about it and 'by default' naming it correctly in your project.

Making Routes more Testable:    We have also gone ahead and changed global.asax to make your routes much more testable by default.  The new global.asax will look something similar to below:

image

You can very easily now call RegisterRoutes externally to test your routes.

Getting Designer.cs/.vb Files Back:  In December 2007 CTP our view pages did not have the .designer.vb and .designer.cs files attached to them, many of you asked us to get that in so that server control useage would become easier.  In the MIX 2008 CTP every View Page, Master Page and Content Page associated with MVC development will come with a pre-created designer.cs/vb file.

image

Debugging Settings:   We have now made some default debugging settings so that your MVC application will debug no matter where you hit F5 in your solution explorer.  You will definitely have option to modify this behavior in the property pages of your MVC Application.

Removing 'View in Browser' & 'Add a Content Page' Commands:  If you right click on .aspx pages within an MVC Application you will not see 'View in Browser' command.  This command has been intentionally disabled as in case of MVC application we want that the calls made are not handled directly to .aspx pages but rather get routed via a controller, which in turn will produce ViewData and redirect to the right View Page.  "Add a content Page' command was also removed from Master Pages in MVC application as creation of View Pages is expected to be location specific depending on the controller and 'Add a Content Page' was not directly applicable in such scenarios.

New Look And Feel:  MVC Application right off the shelf will now also have a much more CSS friendly  and pretty UI which you can start customizing and converting into your real world application.  I am attaching a screenshot of how ASP.NET MVC Application will possibly look like as soon as you hit F5 on this new template.

image

Hope these features help you with using ASP.NET MVC Framework.  In follow up posts on the ASP.NET MVC topic, I will write back about customization of Test Framework dialog box.  In the meantime hope this gets you up to speed with our efforts around ASP.NET MVC Framework.

Thursday, February 14, 2008

Web Deployment Projects (WDP) 2008 Japanese Released

Our Japanese & Redmond team have been working together and just released the Japanese version of Web Deployment Projects for Visual Studio 2008... Our Japanese friends have been patiently waiting for this release since the December 2007 CTP of WDP 2008 was released, so finally this RTW will help unblock a lot of people...

You can read more about the ENU release at http://blogs.msdn.com/webdevtools/archive/2008/01/25/announcing-rtw-of-visual-studio-2008-web-deployment-projects-wdp.aspx

You can download the JPN release from:
http://blogs.msdn.com/webdevtools/archive/2008/02/14/announcing-japanese-release-of-web-deployment-projects-2008.aspx

The announcement in Japanese:
http://blogs.msdn.com/dd_jpn/archive/2008/02/14/7688137.aspx

Hope our friends from Japan will enjoy it...

Friday, February 08, 2008

New Hot-Fix Visual Studio Web Developer now available

 

We just released a hot-fix for VS 2008 which includes a ton of value added features...  We would had loved to have many of these covered within VS 2008 itself but as you can imagine it is not always possible to delay release to get everything in...

The key idea over here is  to be able to provide incremental value over the product frequently and be agile in responding to customer suggestions... With all these value added releases coming out many have said that there are manageability concerns, but I would recommend looking at this as ala carte service, everyone does not need to constantly upgrade if you are not facing any of these issues daily, with VS 2008 SP1 all of this will be rolled up any ways...

The key issues that this hot-fix will address:

HTML Source view performance

  • Source editor freezes for a few seconds when typing in a page with a custom control that has more than two levels of sub-properties.
  • “View Code” right-click context menu command takes a long time to appear with web application projects.
  • Visual Studio has very slow behavior when opening large HTML documents.
  • Visual Studio has responsiveness issues when working with big HTML files with certain markup.
  • The Tab/Shift-Tab (Indent/Un-indent) operation is slow with large HTML selections.

Design view performance

  • Slow typing in design view with certain page markup configurations.

HTML editing

  • Quotes are inserted after Class or CssClass attribute even when the option is disabled..
  • Visual Studio crashes when ServiceReference element points back to the current web page.

JavaScript editing

  • When opening a JavaScript file, colorization of the client script is sometimes delayed several seconds.
  • JavaScript IntelliSense does not work if an empty string property is encountered before the current line of editing.
  • JavaScript IntelliSense does not work when jQuery is used.

Web Site build performance

  • Build is very slow when Bin folder contains large number of assemblies and .refresh files with web-site projects.

Know more and download this hot-fix

You can read more and download the release from our team blog here

Friday, February 01, 2008

MS Web Deployment Tool - Technical Preview Released

We recently released MS Web Deployment tool (msdeploy.exe)... This is really a very handy tool to manage migration and deployment for your IIS based applications and web servers...

At a very high level this tool can do one of the following things:

  1. Migrate IIS 6 applications & servers to IIS 7....
  2. Synchronize & take a snapshot you II6 or IIS7 web
  3. Analysis of installed IIS6 features
  4. Do whatif analysis of your product...

This tool can traverse through and take a snapshot of your IIS web or web server. While traversing this tool takes snapshots of following:

  • Registry settings
  • Directory & Files
  • GAC Assemblies
  • COM Objects
  • Web, root web, app host & machine config
  • Certificates

This information is then used to synchronize between servers... Interestingly I feel it is a great way to create a test or dev box snapshot... Well you can download and read lot more about the tool at the below email:

http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1602