Rob Relyea

xaml:Blog

February 2005 - Posts

  • Issues/Suggestions for November Avalon CTP's VS2005 Add-ons ('Fidalgo')

    Filed under: ,
    When you installed the WinFX SDK with the November CTP, one of the things that is installed is a set of add-ons to Visual Studio 2005 (code named “Whidbey“). Internally, we call these add-ons "Fidalgo". I'll describe what those involve and ask you for feedback and suggestions.

    What else needs to be installed?
    In order to use these add-ons, you need to have installed:

    • Visual Studio 2005 (or one of the Express skus) and DotNetFx 2.0 (these versions must match the version that Avalon was built against!)
    • Avalon (avalon.msi)
    • WinFX SDK - installs offline versions of documentation, a command line prompt with appropriate environment variables set, many tools and the Fidalgo add-ons (this step must be done after the Visual Studio install).

    What Add-ons Get Installed
    Visual Studio Project + Item Templates, Avalon/XAML schemas, registry settings, IntelliSense helper files

    Project Templates
    When you choose File/New Project in Visual Studio 2005, Fidalgo has added the following choices:

    Avalon Application
    Description: Build an application with a typical (non-navigation based) window as the main window.
    Primary Files:

    • MyApp.xaml - Defaults to declare Application object used in your application. Setting is a common use for MyApp.xaml in this and other projects.
    • MyApp.xaml.cs/.vb - Can add new code to your application object
    • Window1.xaml - Defines a "Window" which defaults to be the main window of the application.
    • Window1.xaml.cs/.vb - Add event handling code and other functionality to the window.
    Project File Details: .csproj, .vbproj file has typical settings.

    Avalon Navigation Application
    Description: Build an application with a navigation based window as the main window.
    Primary Files:

    • MyApp.xaml - Declares NavigationApplication settings for this application. NavigationApplication is a subclass of Application and provides application wide navigation events and a general property storage mechanism that all Pages can use.
    • MyApp.xaml.cs/.vb - Can add new code to your application object
    • Page1.xaml - Defines a "Page" which can be navigated inside of a NavigationWindow or .
    • Page1.xaml.cs/.vb - Add event handling code and other functionality to the page.

    Project Details: .csproj, .vbproj file has typical settings.

    Avalon Browser Application
    Description: Build a navigation based application to be hosted in Internet Explorer.
    Primary Files:

    • MyApp.xaml - Declares NavigationApplication settings for this application. NavigationApplication is a subclass of Application and provides application wide navigation events and a general property storage mechanism that all Pages can use.
    • MyApp.xaml.cs/.vb - Can add new code to your application object
    • Page1.xaml - Defines a "Page" which can be navigated inside of a NavigationWindow or .
    • Page1.xaml.cs/.vb - Add event handling code and other functionality to the page.

    Project File Details: .csproj, .vbproj file has True setting* (see readme.txt in this project)

    Avalon Control Library
    Description: Builds a "library" project with a code file in it.
    Primary Files:

    • CustomControl1.cs/.vb - simple class definition that subclasses Control by default.

    Project Details: .csproj, .vbproj file has set library as opposed to winexe for the other 3 project templates.

    Item Templates

    Avalon Window
    Description: Defines a window. Windows can be shown.
    Primary Files:

    • Window1.xaml - Defines a "Window".
    • Window1.xaml.cs/.vb - Add event handling code and other functionality to the window.

    To Use: To show this window, instantiate the window and then call show.

    Window1 win1 = new Window1();
    win1.Show();

    Avalon Page
    Description: Defines a "Page". Pages can be navigated to.
    Primary Files:

    • Page1.xaml - Adds a "Page" to your project.
    • Page1.xaml.cs/.vb - Add event handling code and other functionality to the page.
    Use 1 - Declare a in a Window or Page:
    Use 2 - Navigate to it with a hyperlink from another Page
    Goto page1
    Use 3 - Navigate programmatically
    (won't go into these details yet…)

    Avalon PageFunction
    Description: Adds a "PageFunction" to your project. PageFunctions can be navigated programmatically, and always return an answer. (Thus the "function" in the name).
    Primary Files:

    • PageFunction1.xaml - Defines a "PageFunction". PageFunction is a generic type. x:TypeArguments is the attribute to set to define the return type of the PageFunction.
    • Page1.xaml.cs/.vb - Add event handling code and other functionality to the page function.

    To Use: You must navigate programmatically to page functions because you need to wire an event handler so you can get the return value.

    Avalon Custom Control
    Description: Adds a custom control to your project.
    Primary Files:

    • CustomControl1.cs/.vb - simple class definition that subclasses Control by default.

    Update: Updated several filenames in the text above of Window1.cs/.vb to Window1.xaml.cs/.vb -- the code behind file for foo.xaml would be foo.xaml.cs or foo.xaml.vb

    Visual Studio's New Template Format
    November CTP was the first time we used the new zip-file based structure for these templates. The new template model is a big improvement over the jscript-based templating system of before.
    One of the goals that the Visual Studio team has, is to allow customers to build and share their own templates. Perhaps we'll try shipping a new template in the next few months to try out this "community" model for templates.

    Avalon + XAML Schema Files
    The XML Editor in Visual Studio uses XSD schema files to provide Intellisense support for many XML formats. If you are editing an xml format and want a better experience, you can put an .xsd file in \program files\microsoft visual studio 8\xml\schemas\

    • Fidalgo installs Avalon*.xsd and Xaml*.xsd into this directory.
    • Avalon*.xsd provides a schema that describes how to use http://schemas.microsoft.com/2003/xaml and all the elements & objects that it supports.
    • Xaml*.xsd provides a schema that describes how to use attributes and elements from the "xaml" namespace (which in November has a uri of "Definition")

    XSD Schema doesn't do a great job on XAML intellisense…but it is better that typing blind! The danger is that the schema isn't perfect. It complains about some syntaxes that are perfectly valid (according to the XAML loader and XAML compiler.) It also suggests some syntaxes which won't compile.

    I'll blog more about this in the future…and I've also done some in the past.

    Note1: F1 help doesn't work in the November release from the XML Editor. Help content needs to be tagged with the same keywords that the XML Editor sends to the help system (based on what text you have selected). We weren't coordinated enough to get this to work in November.

    Note2: Occasionally, Visual Studio doesn't recognize that the XAML file is an XML file. Instead it is opened in a typical text editor with no color coding, no intellisense, etc... To workaround, right click a xaml file in the solution explorer and select open with.

    Registry Settings to Tell MSBuild how to treat several File Types
    Currently, we need to tell MSBuild that a XAML file should default to a in the .csproj or .vbproj when you add one to a project. We set values for the following file extensions:

    • .xaml -
    • .xml -
    • .bmp, .gif, .jpg, .jpeg, .png -
    • .ttc, .ttf, .otf -
    • .compositefont -

    We set the keys for Visual Basic & C# under the following 2 keys (don't know offhand which is which…gotta love guids!)

    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\FileExtensions
    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\{F184B08F-C81C-45F6-A57F-5ABD9991F28F}\FileExtensions

    Registry Settings to Tell MSBuild/VS where to look for References
    We also set the following key:

    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\AssemblyFolders\WindowsClient to %windir%\microsoft.net\windows\v6.0.4030

    This tells MsBuild & Visual Studio that it should add that path into the search path for referenced assemblies.

    PresentationFramework.Xml, etc... files in v6.0.4030 directory
    These files provide extra information when you are using the C# or VB code editor.

    FYI - when you are code editing

    1. When you add an element with an ID property set, you can refer to it from your code-behind using that name.
    2. In the November build, you must build your project after you add the ID before intellisense works on that ID in your code.

    What Language support is important to you?
    In November, Fidalgo included C# and Visual Basic support. What languages would you like to see next?

    Language owners - I'd love to help you build support for your language…please contact me if you are interested. (click the contact link on this page.)

    Supporting All the Visual Studio SKUs
    For November, MSDN members can use Visual Studio's Beta 1 CTP. Everybody else must limit themselves to one of the Express versions. Unfortunately, in November, we didn't support the Express SKUs with our setup by default. I had posted how to get November's Fidalgo working with the Visual C# Express and Visual Basic Express. (Update: also, in the January re-release of the November bits, we provided a batch file which fixed this for you.)

    In our next release, it looks like we'll be able to make this work by default. However, you will still need to install your favorite Visual Studio flavor, and then the WinFX SDK! Order matters.

    Should this be installed with the WinFX SDK?
    Today, and for at least the next release, this is being installed with the WinFX SDK. Long term, I don't believe that Fidalgo should be installed in the SDK. Until Orcas comes out, we should have a separate install for these add-ons. I believe the WinFX SDK should not have tool support for Microsoft's development tool (Visual Studio) built into it. The SDK should limit itself to things that would be useful to developers regardless of their tool choice.

    Given all that, how can this improve?
    We understand that you all want us to provide a Visual Designer. Yes, we understand that...
    What else can we do to what I describe above or in addition to that to improve our Developer Experience for you inside of Visual Studio?

    Thanks, Rob

    PostTypeIcon
    8,969 Views