Archive for the ‘Visual Studio 2005’ Category

Our team uses Neutron inside our main product ReviewBasics. That is a really big Visual Studio 2005 solution (55+ projects), including several Neutron projects. In other words, our team is “building next generation Rich Internet Applications that combine Flash on the front-end and .NET on the server-side”, as the home page of Neutron website says.

Currently our flash front-end uses some quite big 3rd-party AS2 libraries which are referenced to Neutron projects (see the note below). The classes within the libraries participate in code complete operations, so it takes some time for IntelliSense database initialization while the project is loading.

Note: Neutron supports Zip reference feature that allows you to link an external library as a zip file, and Neutron automatically unzips and references classes within.

Actually, such possibilities are not needed for our server-side .NET part of the team. Most of them never touch the AS2.0 code. All they need is to compile this code while rebuilding the entire solution.

Well, that can be easily switched off. To disable IntelliSense database creation on project loading go to ‘Tools’ -> ‘Options’ in the main Visual Studio 2005 menu. Select ‘Projects and Solutions’ -> ‘Neutron Project Settings’ in the appearing Options dialog, and uncheck ‘Enable IntelliSense’ checkbox. Next time the projects will be loaded without IntelliSense initialization phase.

In addition, on this option page you can set the path, where MTASC compiler is located. That can be useful if you want to compile with HAMTASC instead. See How To: Substitute MTASC with HAMTASC tutorial.

Also, you can manage cache directory for ZIP references used in your Neutron project.



~ Dmitry


Read Full Post »

About a month ago Aaron Marten wrote a post “CTC is dead…Long Live VSCT! (Part 1)” where he announced a new XML-based format called VSCT, which is far easier to work with than CTC. Two weeks ago James Lau announced VS SDK for Orcas Beta 1 (April CTP). One of the improvements of April CTP is that command table configuration (.ctc) files have been deprecated in favor of XML command table (.vsct) files and all samples that used .ctc files have been converted to use .vsct files.

Well, that is good but it is done for Visual Studio Codename Orcas only. The latest VS SDK 4.0 RTM for Visual Studio 2005 announced a little bit earlier still uses CTC but it includes VSCT compiler in pre-release state. You can find it here: C:\Program Files\Visual Studio 2005 SDK\2007.02\Prerelease\.

This post demonstrates how to add VSCT support for Whidbey (VS 2005) projects.

To demonstrate this we will use the C# Reference.MenuAndCommands sample included into Visual Studio SDK Version 4.0. You can find it in that directory: C:\Program Files\Visual Studio 2005 SDK\2007.02\VisualStudioIntegration\Samples\IDE\CSharp\Reference.MenuAndCommands\. At the end of this tutorial, we will get this sample working with VSCT instead of CTC. Follow instructions below.

1. Before we will substitute CTC with VSCT let’s see how it looks now. Press F5 to run the MenuAndCommands sample in experimental hive and see some menu items added under main menu item ‘Tools’. Note command ‘C# Command Sample’ – it will be our marker in this tutorial.

Before (with CTC)
2. The first thing we should care about is to obtain VSCT analogue for our CTC file. The easiest way to do that is to build the project to get .cto file compiled from current .ctc file and then create a .vsct file from an existing .cto file using VSCT.exe utility. I have used the following command to perform the conversion from <project_root>\obj\Debug\ directory where two input files PkgCmd.cto and PkgCmd.ctsym are located.

>   “C:\Program Files\Visual Studio 2005 SDK\2007.02\Prerelease\VSCT\VSCT.exe” PkgCmd.cto PkgCmd.vsct -SPkgCmd.ctsym

3. Now let’s replace CTC part of the MenuAndCommands sample project with VSCT analogue. Create new folder VSCTComponents under project root directory and copy just generated PkgCmd.vsct file from obj\Debug\ there. Then make it part of the project. To be sure that we have no CTC here let’s remove all from CtcComponents folder except image GenericCmd.bmp, because it is still needed. Let’s also replace the text of the button ‘C# Command Sample’ with ‘C# Command Sample (VSTS)’ to have some differences in resulting UI. See what we have now.

Change the button text to have a visual marker
Note: you can easily add IntelliSense for .vsct files via browsing for C:\Program Files\Visual Studio 2005 SDK\2007.02\Prerelease\VSCT\VSCT.xsd file in ‘Schemas’ property in Properties window (accessible by F4).

4. Rebuild the solution and then execute ‘devenv.exe /rootsuffix Exp /setup’ command to refresh Visual Studio UI. Then press F5 to see the result – all menus disappeared. To get all back in VSCT incarnation of menu items we need to write some code right in MenuAndCommands.csproj project file. To do that unload the project and open it for editing using ‘Edit MenuAndCommands.csproj’ command.

Open project file for manual editing

5. Add the following line importing .targets file as it is shown on the picture below. I have prepared the VSCT_overrides.targets file, so you just need to download it and save in the project root directory.

Import .targets file containing overriden MSBuild targets

6. Now our PkgCmd.vsct file declared as <None Include=”VSCTComponents\PkgCmd.vsct” /> in MenuAndCommands.csproj file. Replace this line with the following code. Child node ResourceName specifies the name of CTO object which will be merged into assembly resources with.

Use VSCTCompile tag for .vsct file
7. Save the changes and reload the project. Select ‘Load project normally’ option in the Security Warning dialog which will be appeared. Rebuild the project and see results in output window. There are 4 errors that occurred due to automatic generation.

Four errors of automatic VSCT file generation shown in Visual Studio Output window

Note: make sure you use ‘Normal’ level of MSBuild build output verbosity.
8. You can easily fix them by adding 4 IDSymbol tags under according GuidSymbol tags or just download fixed version of PkgCmd.vsct file I have prepared. Then build the project again and verify that all errors go on.

VSCT file compiled with no errors
9. Rebuild the solution and then execute ‘devenv.exe /rootsuffix Exp /setup’ command to refresh Visual Studio UI. Then press F5 to see the result – menus appeared again. Note the changed text ‘C# Command Sample (VSTS)’.

After (with VSCT)



Read Full Post »

SharpStyle Neutron uses excellent open source ActionScript compiler called MTASC developed by Nicolas Cannasse. Click here to read Comparison with Macromedia ActionScript compiler. But if you are an advanced ActionScript developer, you might also be familiar with HAMTASC. SharpStyle Neutron makes it very easy to substitute one compiler with another.

This tutorial will demonstrate how to substitute MTASC with HAMTASC.

Actually, it is very easy in Neutron. There are a few steps to do:

1. Open Hello World sample in Visual Studio 2005 and compile it. As you can see in Output window screenshot below, HelloWorld project has been successfully built with MTASC:

Compilation result in Visual Studio Output window

2. Now let’s substitute MTASC with HAMTASC compiler. You can set the path to the compiler in Visual Studio under Tools -> Options -> Projects and Solutions -> ActionScript Project Settings -> MTASC path. Browse the HAMTASC executable file mtasc.exe and then press OK to apply the changes. 

Tools -> Options -> Projects and Solutions -> ActionScript Project Settings -> MTASC path 

3. Build the project again, but this time with HAMTASC compiler:

Compilation result in Visual Studio Output window

4. As you might know HAMTASC uses some additional compilation options, which can be added to compilation command thanks to Neutron Project Properties:

HelloWorld project Project Properties in Visual Studio 



~ Dmitry

Read Full Post »


Working on SharpStyle Neutron I very often need to open the Visual Studio IDE under as named experimental hive. MSDN describes the concept of Visual Studio Experimental Build in following way:

To safeguard Visual Studio from applications you develop that might change it, the Visual Studio SDK provides an experimental build of Visual Studio. You develop new applications by using Visual Studio as usual, but run them with the experimental build.

The experimental build is nothing more than Visual Studio with another registry hive called the experimental hive. Having two side-by-side registrations of Visual Studio helps protect your Visual Studio installation from any harm that the experimental software could cause.

To start Visual Studio by using the experimental registry hive, run the following command from the Visual Studio command prompt:

“<Visual_Studio_Install_Path>\Common7\IDE\devenv.exe” /RootSuffix Exp

As you can see every time I need to run the Visual Studio in experimental hive I have to execute the command above or use the shortcut located in Start -> Programs -> Visual Studio 2005 SDK -> 2007.02 -> Tools -> Start Visual Studio 2005 under Experimental hive.

One day I spent a lot of time to do such procedure many and many times. And the first improvement was an assigning the shortcut key for the shortcut.

Well, it works much better that going through the Start->Programs… every time. I used this solution but problem was not solved.

To open the solution in normal registry hive you can just double click on .sln file or select from context menu item ‘Open’ or item ‘Open With’ and then select the program you want the file be opened with. I prefer the last way because I often edit the files in different editors.

So the common case is following. I navigate to the folder where .sln file located, right click on it to open in… yes … in experimental build of Visual Studio! So now I have to press the CTRL+SHIFT+E to run the experimental build of Visual Studio and then I have to use File->Open and navigate to the folder I was again. Not very comfortable scenario.

I start thinking and have found the simple and going solution – add a new subitem  to ‘Send To’ context menu item. To add new command in ‘SendTo’ menu all of you need is to create the shortcut to command you want in this path:

C:\Documents and Settings\<Your_Account>\SendTo\

I just copied the shortcut from “Start -> Programs -> Visual Studio 2005 SDK -> <VSSDK_Version> -> Tools -> Start Visual Studio 2005 under Experimental hive” and renamed it to “Devenv Exp”. Now to open the solution in experimental hive I just right click on .sln file and select Send To -> Devenv Exp.




Read Full Post »

As I was preparing for tutorial of using SharpStyle Neutron to develop an ActionScript project and Windows Forms within one solution, I ran into the following issue: while there are a number of references on the web on how to use Flash OCX within Visual Studio 2003, there are only a handful of results related to Visual Studio 2005 and most of them document the problems that people are having.

Following the steps from this article (Macromedia – Developer Center Embedding Macromedia Flash Player in a C# Application) produce the following errors:

  • There is a popup stating that VS “Failed to import the ActiveX control.  Please ensure it is properly registered
  • If you examine Error List, under Warnings, you will see the following

Could not resolve dependent COM reference “stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.  

Failed to create the wrapper assembly for type library “AxShockwaveFlashObjects”. Exception of type ‘Microsoft.Build.Tasks.ComReferenceResolutionException’ was thrown.

The referenced component ‘AxShockwaveFlashObjects’ could not be found. Failed to create the wrapper assembly for type library “AxShockwaveFlashObjects”. Exception of type ‘Microsoft.Build.Tasks.ComReferenceResolutionException’ was thrown. 

I found the following Unable to add Flash 8 control in VS2005 – Tentative workaround blog post from 2005-12-07, but the instructions there didn’t work. After doing a few more searches I found the following forum page in French (translated page / original page)

Here is what needs to be done:

  • Open Visual Studio 2005 command prompt and execute the following:
    • aximp.exe -source “C:\WINDOWS\system32\Macromed\Flash\Flash9b.ocx”
  • This will generate the following files. Items in bold are the important ones:
    • AxShockwaveFlashObjects.dll
    • AxShockwaveFlashObjects.pdb
    • ShockwaveFlashObjects.dll
    • AxShockwaveFlashObjects.cs

  • In Visual Studio, add the references to the 2 dlls generated by aximp (I copied them from “C:\Program FIles\Microsoft Visual Studio 8\VC” to the root of the project): 

  • Add namespaces to the imports section

using AxShockwaveFlashObjects;
using ShockwaveFlashObjects;

  • And here is some sample code to display SWF
AxShockwaveFlash axShockwaveFlash = new AxShockwaveFlash();
axShockwaveFlash.Location = new System.Drawing.Point(50, 50);   

this.Controls.Add (axShockwaveFlash);
//this.Show(); // Avoids InvalidActiveXStateException.

axShockwaveFlash.Movie = "D:\\test.swf";
//* it is important to set Size after specifying Movie property
//* if Size is specified before, it is ignored
axShockwaveFlash.Size = new System.Drawing.Size(20, 20);


Read Full Post »

Clearing Visual Studio recent projects list

Clearing Flash 8 Recent Items list

Read Full Post »