About Author

Shabir has 12 yrs of exp in I.T using Asp, Asp.NET, Vb6/.NET/C#, MOSS/WMI/html/DOM, Ajax, XML,xsl.SharePoint

Name:Shabir Hakim
Country: India
Gender: Male
Issues When Using Microsoft Visual Studio 2005

1.1   VC++ Visual Studio 2005 Beta 2 Project File fails to open 

When you use the final version of Visual Studio 2005 to open a Beta 2 C++ project that was last loaded on a computer with an installation location for Visual Studio that is different from that on the current computer, or if the project paths have changed, you might receive an error.

To resolve this issue

Edit the project settings file. Right-click on the grayed-out project node in the solution explorer and select “Edit <projectname>.vcproj”, which will bring up the file in the XML editor. Change the value of the InheritedPropertySheets tag to “$(VCInstallDir)VCProjectDefaults\UpgradeFromVC70.vsprops”, and then reload the project. 

1.2   On Windows 2000, using Start with Application Verifier produces the message: "Application Verifier is not supported on the Operating System running on machine_name. Please upgrade to Windows XP or above." 

Windows 2000 does not support the Application Verifier.

To resolve this issue

Upgrade to Windows XP or above. 

1.3   Start with Application Verifier generates the dialog box: "Application Verifier requires an updated system file that is not detected on your machine machine_name. Do you want to go to Windows download center to get the update?" 

Visual Studio setup does not install a system file that is required by Application Verifier.  If the required version of the file is not present on your computer's operating system, you must update it before you can use Application Verifier.

To resolve this issue

Select 'Yes' on the dialog to open the internet browser and show the update link on the Microsoft download center site. Install the required update. You also can access the Microsoft download center using this link:
http://go.microsoft.com/fwlink/?LinkId=49500

1.4   Toolbox in Distributed System Designers does not reflect the local Windows language setting until Toolbox is reset. 

In the Options dialog box, users can set Visual Studio to use the local Windows language.  However, the Toolbox in Distributed System Designers does not reflect this setting until the Toolbox is reset.

To resolve this issue

1) Close all Distributed System Designers (Application Designer, System Designer, Logical Datacenter Designer, and Deployment Designer).
2) Right-click inside the Toolbox and then click Reset Toolbox.
3) Reopen the Distributed System Designers you want to use.

1.5   Remote Debugging on Windows 98 and Windows Me  

Problem 1:


If using Visual Studio 2005 to remote debug with default transport to a Windows 98 or Windows ME computer that is part of a domain with a Windows Server 2003-based Domain Controller, the user may see the following error message approximately 10 minutes after starting the Windows 98/ME computer:

-------------------------
Microsoft Visual Studio
-------------------------
Unable to connect to the Microsoft Visual Studio Remote Debugging Monitor named '<machinename>'. Access is denied.

Cause: Server Message Block (SMB) signing is both enabled and required on Windows Server 2003-based Domain Controllers.
 

Problem 2:

If using Visual Studio 2005 on a Windows XP or later computer to remote debug to a Windows 98 or Windows ME computer, the user may see the following error message.

-------------------------
Microsoft Visual Studio
-------------------------
Unable to connect to the Microsoft Visual Studio Remote Debugging Monitor named '. The Microsoft Visual Studio Remote Debugging Monitor on the remote computer cannot connect to the local computer. Unable to initiate DCOM communication. Please see Help for assistance.

Cause: "Remote Access for Anonymous Logon in DCOM" is disabled on the computer running Visual Studio 2005.
 

To resolve this issue

Problem 1:


1) Set the Domain Controller policy such that SMB signing is enabled but not required.
For information on how to do the same go to http://support.microsoft.com/?kbid=887429
2) Restart the Domain Controller
3) Restart the computer where Visual Studio 2005 is installed.
4) Restart the computer running Windows 98/ME

Problem 2:


To allow "Remote Access for Anonymous Logon in DCOM" on the computer running Visual Studio 2005, follow these instructions:
1) At a command prompt, type dcomcnfg, and then press ENTER. Component Services opens.
2) In Component Services, expand Component Services, expand Computers, and then expand My Computer.
3) On the toolbar, click the Configure My Computer button. The My Computer dialog box appears.
4) In the My Computer dialog box, click the COM Security tab.
5) Under Access Permission, click Edit Limits. The Access Permission dialog box appears.
6) Under Group or user names, click ANONYMOUS LOGON.
7) Under Permissions for ANONYMOUS LOGON, select the Remote Access check box, and then click OK.
8) Restart the computer.

1.6   Pressing F1 on a Web service provider endpoint results in "Information Not Found". 

When you press F1 while a Web service provider endpoint is selected on an application diagram, a relevant Help topic cannot be found.

To resolve this issue

In Help, search for "How to: Define Operations for ASP.NET Web Services". 

1.7   Users should not store sensitive information in custom settings or in settings not defined as secure settings by SDM documents. 

Sensitive information stored in custom settings or in settings not defined as secure settings by SDM documents (such as .sdm and .ad files) will appear as plain text in these files.

To resolve this issue

When using the Settings and Constraints Editor, store sensitive information only settings that are designated as secure settings in SDM documents. For more information, see "How to: Create Custom Settings for Applications, Servers, Endpoints, and Zones" and "Considerations for Implementing Applications" in Help. 

1.8   Starting the Itanium (IA64) native tools command prompt  

When installing the tools on Itanium (IA64), a shortcut for starting the Itanium (IA64) native tools command prompt is not created.

To resolve this issue

The Itanium (IA64) native tools command prompt can be started by doing the following:
1) Go toStart, clickRun
2) Typecmd
3) At the command prompt, type <Your Visual Studio 2005 installation directory>\VC\bin\vcvars64.bat

1.9   Profiling and running instrumented modules from network shares is not supported 

Under default Visual Studio settings, running an instrumented binary from a network share results in an unhandled exception.

To resolve this issue

Copy or move the project or binary you wish to profile to your local hard drive.

1.10    Using Event Tracing for Windows (ETW) to collect event profiling data for IIS5.1 is not supported 

Trace profiling an application that targets IIS5.1 and enabling the collection of ETW events will silently fail in the UI and report an erroneous Error VSP1432 on the command line. 

1.11   IA64 profiling is not supported 

IA64 profiling is no longer supported. 

1.12   Stand-alone profiler does not support code coverage 

When you try to run code coverage on a stand-alone profiler installation, you will see an unhandled exception 

1.13   Running code coverage against an ASP.NET application may leave web.config in an altered state. 

When running unit tests against an ASP.NET project, the test engine needs to modify the web.config files. Sometimes these files are not cleaned up and can cause exceptions in subsequent test runs and application runs.

To resolve this issue

Restore the original web.config file from the backup that was created during the test run. 

1.14   Support for ReportViewer Control is limited on Windows 98 

The Windows Forms ReportViewer control has limited support when used in applications running on Windows98. With this control, you can only view reports previously published on a SQL Server 2005 Reporting Services report server. You cannot use it to view client report definition (.rdlc) files in local processing mode.  

1.15   Code coverage for ASP.NET will not work if the IIS worker process is running as SYSTEM 

Collecting code coverage data for ASP.NET will not work if the IIS worker process is running as SYSTEM.  Check MSDN for the name of the IIS worker process on your system because the name is different for different versions of IIS. You can use Task Manager to determine what user the worker process is running under.
Note: The unit tests will run correctly if code coverage is disabled.

To resolve this issue

Change the IIS worker process not to run as SYSTEM. 

1.16   Trying to profile an ASP.NET application with forms authentication enabled results in an error

If you try to profile an ASP.NET application with forms authentication enabled, you will get a web site configuration error and the application will not run.

To resolve this issue

There is no known resolution. 

1.17   Performing actions on Distributed System Designer diagrams while code is running will cause Visual Studio to stop responding. 

For example, adding applications to a system diagram in System Designer while the Debugger is running will cause Visual Studio to stop responding.

To resolve this issue

Do not run code performing actions on Distributed System Designer diagrams. 

1.18   Trace profiling a shared dll will profile all processes using that dll 

If you have a shared dll and want to trace profile it, you might end up profiling all processes that are using it.

To resolve this issue

1) Turn off profiling on each process you do not want to profile using vsperfcmd -proccessoff:PID.
2) Set HKCU/software/microsoft/visual studio/8.0/VSPERF/Monitor/Settings/ProcessProfile=Off, start your target processes, and then enable profiling on all processes you want to profile using vsperfcmd -processon:PID
Note: When you have finished profiling, you must shut down all processes that are using the shared dll in order to shut down the monitor and flush the data to the report file. 

1.19   How to trace profile Natively Generated (ngen'd) images 

Trying to instrument an ngen'd image will report an erroneous VSP1014 error.
The CLR will not load an instrumented managed binary that has already been ngen'd.

To resolve this issue

Once you have instrumented the managed binary itself and not the ngen'd image, you must do one of the following:

1) Delete the ngen'd image so that the CLR uses the instrumented binary
-or-
2) Regenerate the binary using ngen.exe. 

1.20   Crash if the MarkProfile profiling APIs are used and the profiler monitor is not running

When using MarkProfile, CommentMarkProfile, or CommentMarkAtProfile that are available from vsperf.h, you will see an application crash if the profiler monitor is not running. This will be most noticeable if you add the API calls and then launch them under the debugger instead of the profiler.

To resolve this issue

Start the profiler monitor using "vsperfcmd -start:sample -output:foo.vsp" 

1.21   Web projects: Types defined in a GAC'ed assembly cannot be visualized in class diagrams 

Class diagrams cannot show types in a referenced assembly if all the following conditions are true:
1. Class diagram resides in a web project.
2. The referenced assembly is installed under the Global Assembly Cache (GAC)
3. The referenced assembly is not installed under the framework directory root ("Microsoft.Net\Framework\<Version>\").

To resolve this issue

Visualize the referenced type from a non-web project. 

1.22   Instrumented managed dll fails to load into a website project 

An instrumented managed user control hosted in a website will fail to load with the default security settings for .NET.

To resolve this issue

You must enable Full Trust for the local website to be able to load the instrumented dll.
caspol.exe -ag 1.2 -url http://localhost FullTrust 

1.23   Application Verifier is not enabled for mixed mode C++ projects. Instead it will produce the following dialog box:
"Application Verifier is not supported for the selected debug mode. Please see supporting documentation for more information. Click on OK to continue debugging without verifier" 

Application Verifier is not enabled for mixed mode applications even though you can select it from the Debug menu.

To resolve this issue

Continue debugging without Application Verifier. 

1.24   Profiler driver is not being initialized correctly on Windows 2000

The first time the profiler driver is used, it needs to initialize itself. If this initialization happens on Windows 2000 Server via remote desktop session, the driver will be initialized for future sessions but not for the current one.  If you try to start the monitor on the current session, you will see Error VSP1398 and the monitor will fail to start.

To resolve this issue

Do one of these:

1) Restart the computer.
-or-

2) Use remote desktop to connect to a different session on the same computer. 

1.25   Test runs window: Users in "Controller users" group and not in "Admin users" are not able to connect to controller  

When a user is added to the "Controller users" group and not to the "Controller admin" group the change does not take affect until the controller service is restarted. As a result, the user cannot connect to the controller.

To resolve this issue

Restart the controller service. 

1.26   Encoding changes might not appear when a file is reloaded in the editor. 

Visual Studio 2005 does not detect changes in encoding when a file is reloaded. If you have changed the encoding of a file outside of the current editor, or performed a source control operation that changed the encoding of a file open in the editor, Visual Studio reloads the file automatically. The contents of the file might display incorrectly after it has been reloaded in the editor.

To resolve this issue

  1. Close the file without saving the changes.
     
  2. On theFilemenu, chooseOpenand then selectFile.
     
  3. In theOpen Filedialog box, click the arrow adjacent to theOpen button and clickOpen With.
     
  4. From the list in theOpen Withdialog box, select the editor into which you want to open the file, such as the Binary or Resource editor. To open the file with a particular encoding, select an editor with encoding support, such as XML Editor with Encoding.
     
  5. ClickOK.
     
  6. In theEncodingdialog box, select the correct encoding from theEncoding drop-down list.
     
  7. ClickOK.

1.27   Product repair occurs when installing Setup project 

If Visual Studio 2003 is installed after Visual Studio 2005, then building a Setup Project from either version of Visual Studio causes product repair to occur. The product repair only occurs for users other than the one who installed Visual Studio 2003.

To resolve this issue

When the product repair occurs, allow it to complete. For the repair to be successful, it must be performed from a user account that did not perform the installation of Visual Studio 2003 and has admin privileges.

 

1.28   Office product fails to run after installing Visual Studio 2005 Tools for Microsoft Office project 

After installing a Visual Studio 2005 Tools for Microsoft Office add-in project that contains a Reg-free COM component, the Office product targeted by the add-in fails to run.

To resolve this issue

Reg-free COM is not supported for Visual Studio 2005 Tools for Microsoft Office add-in projects.

1.29   Setup and Deployment projects imported from Visual Studio 2003 fail to be signed when built 

Setup and Deployment projects imported from Visual Studio 2003 that have signing enabled will not be signed when built in Visual Studio 2005. The following message will appear in the Error List window at build time: "The file ' <filename> ' was not signed. The deployment project contains deprecated signing properties. See Help for more information."

To resolve this issue

To enable signing, you may invoke the Software Development Kit tool, Signtool, on the build output from a post-build step in the Setup and Deployment project. More information on how to do this is available by viewing the help topic associated with the build message referred to above. You can access help by highlighting the message in the Error List window and then pressing F1.


To remove deprecated signing project properties:
1. Double-click the message in the Error List window
2. In the dialog that appears, click 'Yes.' This will cause the deprecated signing project properties to be removed from your project file.

1.30   Certain bootstrapper packages available with Visual Studio 2005 target only 32-bit platform 

The bootstrapper packages for .NET Framework 2.0, SQL Server Express 2005, Microsoft Visual J# Redistributable, Windows Installer 2.0, and Windows Installer 3.1 available with Visual Studio 2005 target only 32-bit platforms. If a bootstrapper built with these packages is run on a 64-bit platform, the installation might block.

To resolve this issue

The bootstrapper packages for the 64-bit versions of the .NET Framework 2.0 and SQL Server Express 2005 redistributables will be made available on the Microsoft download center.

1.31   User Defined Types as Settings may cause unexpected behavior in the settings designer 

Using User-Defined Types as Settings might cause problems if the assembly in which the UDT resides is updated while the consuming project is open. If this scenario is required, you can workaround the problem by making the UDT assembly use incremental version semantics.

To resolve this issue

If the User Defined Type that is being used as a setting resides in a class library, incrementally version the library to mitigate the problem. If the User Defined Type resides in an EXE, the IDE must be closed and restarted for changes to the UDT to take affect.

1.32   No Forms property in "My" inside a User Control project 

My.Forms will not be available in a User Control project

To resolve this issue

There is no known resolution. 

1.33   Cannot invoke an object's method through remote debugging if stopped on Sleep 

If you have the following code running on a remote computer, then attach to the running code via remote debugging, and break as execution is inside the call to Sleep(), you will be unable to evaluate members of the variable c.

c = New c1     'assume c1 is a valid class
While True
Threading.Thread.Sleep(1000)
End While

To resolve this issue

Step out of the Sleep(), you will then be able to evaluate objects normally. 

1.34   Visual Studio 2005 Team Edition for Testers: Load Test Error Table Contains: "Could not Find Dependent Counter Needed to Apply Threshold Rule" 

The load test result viewer's Error Table contains an error with the message “Could not find dependent counter needed to apply threshold rule”. The load test contains a threshold rule that compares one performance counter with another. This error is generated if the comparison performance counter does not generate an instance during a sampling interval.

To resolve this issue

Change the associated threshold rule to compare against a constant instead of another performance counter. This does not affect the results of the load test beyond failing to run the specified threshold rule and can be safely ignored.

Use the following procedure to change the counter:
1. Edit the load test and select Counter Sets/Load Test/Counter Categories/LoadTest:Request/Counters/Avg. Connection Wait Time/Threshold Rules.
2. Delete the Compare Counters Rule.
3. Right-click to add a Compare Constant rule.
4. In the rule, set Alert if Over to true, warning to .01 (10 ms) and critical threshold to .02 (20 ms). 

1.35   Visual Studio 2005 Team Edition for Testers: Web test run fails with the error, “Object not set to an instance of an object” 

Running a coded web test with an unused data source fails with the error “Object not set to an instance of an object”. This occurs because a data source is defined within a coded web test but it is not bound to any item in the test.

To resolve this issue

Remove the unused data source from the coded web test or bind a field from the data source to an item in the test by adding a DataBinding attribute to the test class. 

1.36   Visual Studio 2005 Team Edition for Testers: Set the Proxy Property of a SoapHttpClientProtocol Implementations to Null 

If you are running a load test containing unit tests that call Web services, the unit test code should explicitly set the proxy property of the Web service proxy class that implements System.Web.Services.Protocols.SoapHttpClientProtocol. This prevents a performance bottleneck that can occur when the proxy must be automatically detected.

For example, if you have a Web service proxy class such as this:

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="InstantOrderSoap", Namespace="http://tempuri.org/")]
public partial class InstantOrder : System.Web.Services.Protocols.SoapHttpClientProtocol {

}

then after creating the proxy object, and before using it, explicitly set the Proxy property:

InstantOrder orderCheck = new InstantOrder();
orderCheck.Proxy = new WebProxy("myproxy", true); 

1.37   Cannot pass a structure to a variant property in an ActiveX EXE object 

On Windows 98, you cannot pass a structure to a variant property in an ActiveX EXE object. The problem is that on a clean Windows 9X computer, the System DLL rpcrt4.dll was not registered by default, so the operating system is missing the registration key [HKEY_CLASSES_ROOT\CLSID\{B5866878-BD99-11D0-B04B-00C04FD91550}]. The invocation fails because of this missing registration.

To resolve this issue

Go to C:\Windows\System and manually invoke RegSvr32.exe rpcrt4.dll.  

1.38   New on a type parameter with cyclic constraints causes VB compiler to hang and increases memory allocations 

Pasting the code below in a console application will cause it to hang.

Class C1(Of U As U)    'the cyclic constraints here cause the later problem
End Class

Partial Class C1(Of U)
Dim x As New U        'Issue - this causes infinite looping and the memory usage keeps increasing till memory is no longer available

End Class

To resolve this issue

Remove the cyclic constraint. 

1.39   Parameters to StartupNextInstanceEvent handler will not contain command line arguments if application is started using ClickOnce 

Parameters to StartupNextInstanceEvent handler will not contain the command line arguments of the second instance of the application if application is started using ClickOnce. You must use the My.Application.Deployment.ActivationUri property to get the command line arguments.

To resolve this issue

Use the ASP runtime classes to get the command-line arguments, as follows:

Imports System.Web

Dim commandLineArgs as NameValueCollection = _
HttpUtility.ParseQuery(My.Application.Deployment.ActivationUri) 

1.40   VB compiler doesn't support InternalsVisibleTo attribute 

<Assembly: InternalsVisibleTo("Foo.Dll, PublicKeyToken=a29c01bbd4e39ac5")>

This attributute (among other things) exposes Friend types to other assemblies. This attribute is not supported by the VB compiler.

Some unit testing technologies that rely on this attribute for testing private types will not work as expected.

To resolve this issue

There is no known resolution. 

1.41   Some documentation for vsperfcmd.exe is missing 

Documentation of vsperfcmd that describes common user scenarios is missing.


Here are some examples of common commands that you might use with vsperfcmd.exe:
vsperfcmd -start:sample -output:foo.vsp
vsperfcmd -start:trace -output:foo.vsp -counter:g,1,0,InstructionsRetired
vsperfcmd -launch:foo.exe -args:"input arguments" -gc:lifetime
vsperfcmd -attach:foo.exe -pf:1 

1.42   My.Log is not available in a VB Web Control Library project. 

In a VB Web Control Library project, My.Log is not available.  Because My is per-project, My.Log will be available for WebUserControls inside a Web site project, but it will not be available for classes within Web Control Library projects that are consumed by a Website.

To resolve this issue

Use Trace.Write instead of the My.Log methods. 

1.43   My.Application.Log.WriteEntry may throw an exception if user does not have File I/O permission. 

1) Create a new Console Application with the following code:

    My.Application.Log.DefaultFileLogWriter.CustomLocation = "D:\temp"
    My.Application.Log.WriteEntry("Foo")

2) Run the application

RESULTS:
Log file is created in D:\temp, but the directory D:\Documents and Settings\<username>\Application Data\Microsoft\WindowsApplication1\1.0.0.0 is also created if it does not exist. In the case that the user does not have permission to do this, an exception is thrown. This is likely to occur when using a class library in a Web application, because the ASP.NET process does not have write permission to any Application Data directory by default.

To resolve this issue

1) Remove the default FileLogTraceListener via app.config, and Reconfigure My.Application.Log to use a different TraceListener.
2) Listen to Unhandled Exception event and continue when the event happens.
3) Try/catch every logging call (or at least the ones that could conceivably be the first to execute). 

1.44   References to 32-bit COM components may not work in VB and C# Applications running on 64-bit platforms 

Most existing COM components are only available for 32-bit platforms and will not run in a 64-bit process on a 64-bit platform (although they will run correctly in a 32-bit process on a 64-bit platform). VB and C# applications that reference these 32bit COM components will not run by default on a 64-bit platform because by default the application will launch as a 64-bit process.

The problem appears when a project with one or more COM references is:
1. Migrated to Visual Studio 2005 and executed on 64-bit platforms

-or-
2. Created using Visual Studio 2005 on 64-bit platforms.

In Visual Studio 2005, the VB and C# compilers use the platform target property to determine if the.exe or .dll should run in 32-bit or 64-bit CPU architecture mode. The default setting for this property in Visual Studio 2005 is set to 'AnyCPU', which indicates that the application can run in either 32-bit or 64-bit mode, depending on the host platform. In this situation you may see a message such as "Cannot instantiate class …" when you debug or run these applications.

To resolve this issue

Set the platform target property to 'X86' for your VB or C# projects that have references to COM components.

For C# Projects:
1.    Right click the project in the solution explorer and open 'properties'
2.    Choose the Build tab
3.    Set the Platform Target property to 'X86'

For VB Projects:
1.    Right click the project in the solution explorer and open 'properties'
2.    Choose the Compile tab
3.    Press the Advanced Compile Options… button
4.    Set the Target CPU property to 'X86'

Express Editions:
The VB and C# Express products do not expose the Target property inside the development environment. You will need to carefully modify the project file using a text or XML editor.
1.    Close the project and/or solution
2.    Select Open File from the File menu
3.    Navigate to the project directory, and highlight the project file
4.    Press the Open button, the project file should open in the XML editor
5.    Locate the first <PropertyGroup> section and add the following line:
<PlatformTarget>x86</PlatformTarget>
1.    Save the project file
2.    Reopen the project and/or solution using Open Project/Solution from the File menu
3.    Continue with development, debugging, and testing

Alternatively, if the application is targeted to 64-bit platforms, you can ensure that the COM controls added to the application have 64-bit equivalents on the development and deployment computers.

1.45   Using Windows Roaming Profiles may cause first time launch message to show on each startup. 

When any one of the Visual Studio family of products is used with Windows Roaming Profiles, the first time launch message that says "Visual Studio 2005 is configuring the environment for first time use. This might take a few minutes." might appear on every session startup. This might cause unnecessary slowdowns in startup performance.

To resolve this issue

Click on the Tools > Options... Select "Import and Export Settings", and change the path under "Automatically save my settings to this file:" to a path that is NOT under the "My Documents" directory.

1.46   Installation of an Add-in that accesses DTE.CommandBars before Visual Studio 2005 has been launched will lead to an Add-in load error 

After first installing Visual Studio 2005, if an Add-in is installed that tries to get DTE.CommandBars in its OnConnection, first launch of Visual Studio 2005 will result in the following message:

    The Add-in <Add-in name> failed to load or caused an exception.
    Would you like to remove this Add-in?

To resolve this issue

If you are installing Visual Studio 2005, after installation launch Visual Studio and shut it down again *before* installing any Add-ins 
If this Add-in was already installed and you encounter the above message, click “No” and close Visual Studio. In a Command Prompt, navigate to <VSInstallDir>\Common7\IDE and run the following command:
    devenv /resetaddin *
 

1.47   Web service references in Visual Basic or Visual J# class libraries might not reverse-engineer when building the class library is performed last. 

In this scenario, a Visual Studio solution contains a Visual Basic or Visual J# class library, which contains a Web reference to a Web service. The solution also contains an ASP.NET Web site, which has a reference to the class library. After these items are added to the solution, certain configuration file entries must be copied from the class library's App.config file to the Web site's Web.config file. If the class library is built after copying the configuration file entries but before adding an application diagram to reverse-engineer these items, only the ASP.NET Web site might be reverse-engineered on the diagram. Therefore, the Web service reference might not reverse-engineer as Web service consumer endpoint on the ASP.NET application and a connection to the referenced Web service might not be reverse-engineered. If the Web reference is for a Web service that is not already on the diagram, then an external Web service for the referenced Web service might not reverse-engineer.

To resolve this issue

1. After the application diagram is added, right-click the Web reference in the class library and choose Update Web Reference.
2. Rebuild the class library. 

1.48   Changing Table locations may cause connection to fail 

When you change the location of a table to a different database at run time, ensure that the new database contains a table that uses the same name as the one found in the original report. If the table names do not match, the connection will fail.

To resolve this issue

Make sure that the new database contains a table that uses the same name as the one found in the original report 

1.49   Do not use the Null string to set the viewer Selection Formula 

To set the viewer selection formula to display all of the records in a report, use the empty string instead of the null string. The null string fails to override the original report-selection formula.

To resolve this issue

The empty string is represented as "" or String.Empty. The null string is represented as null in C# or Nothing in Visual Basic. 

1.50   Migrating projects encoded in Shift-JIS may result in corrupt characters 

Japanese characters encoded as Shift-JIS will not appear correctly in an ASP.NET Web Application that has been migrated from Visual Studio 2002 or Visual Studio 2003 to Visual Studio 2005

To resolve this issue

Before migration, convert all of your ASP pages to UTF-8 

1.51   Namespace references lost when importing a project from Crystal Reports 9 or Crystal Reports 10 

References to the CrystalDecisions.ReportSource, CrystalDecisions.Shared, and CrystalDecisions.Windows.Forms assemblies are lost when a Windows Project from Crystal Reports 9 or Crystal Reports 10 is migrated to Crystal Reports for Visual Studio 2005.

To resolve this issue

Before you compile the application after migration, add the references manually. 

1.52   Web service reference in a class library might not reverse-engineer when a Windows and ASP.NET Web project both reference that same class library. 

In this scenario, a Visual Studio solution contains an application diagram with an implemented Windows and ASP.NET application. The solution also contains a class library with a Web reference to a Web service. The Windows and ASP.NET Web projects both reference this class library. After the class library is built and the necessary entries are copied from the class library's App.config file to both projects' configuration files, the Web reference might not reverse-engineer as a Web service consumer endpoint on the Windows or ASP.NET application. A connection to the referenced Web service might also not reverse-engineer. If the Web reference is for a Web service that is not already on the diagram, then an external Web service for the referenced Web service might not reverse-engineer.

To resolve this issue

1. Close the application diagram.
2. Remove references to the shared class library from the Windows and ASP.NET projects.
3. Add the class library reference to the ASP.NET project.
4. Open the application diagram.
5. Add the class library reference to the Windows project.  

1.53   Expanding data files in server explorer in FTP Webs can crash the IDE 

If you open a FTP web site and add a data file (MDB or MDF) to the App_Data directory, then open the Server Explorer window and expand the connection to the data file
under the Data Connections node, the IDE can crash or hang, and you may lose any unsaved data.

To resolve this issue

Develop the web site from a local file location using a file system or IIS web site, and use the Copy Web Site command to transfer files to and from the FTP location. 

1.54   Printing or Exporting from Firefox may throw an exception 

An exception may be thrown when users export or print a report from a CrystalReportViewer control. This problem happens when the web page includes a CrystalReportViewer control and Microsoft Web Controls and is viewed in the Firefox web browser.

To resolve this issue

Set EnableEventValidation to False in the ASP page to allow users to print or export a report in Firefox. 

1.55   Application Verifier is not enabled for mixed mode C++ projects. Instead it will produce this message:
"Application Verifier is not supported for the selected debug mode. Please see supporting documentation for more information. Click on OK to continue debugging without verifier" 

Application Verifier is not enabled for mixed mode applications even though you will be able to select it from the Debug menu. A dialog box will appear noting that Application Verifier is not enabled and will allow you to continue debugging without Application Verifier.

To resolve this issue

Continue debugging without Application Verifier. 

1.56   Visual Studio 2005 Team Edition for Testers: Load Test Results are not Stored in the Results Database Despite Proper Configuration 

Load test results from a local run are not stored in the results database despite proper configuration of the load test. When this occurs, this message is displayed:
"The load test results database could not be opened. Check that the load test results database specified by the connect string for your Test Controller (or local computer) specifies a database that contains the load test schema and that is currently available."
The local load test results database is created during the initialization of the first local load test run. This error occurs if the user initiating the first load test run does not have sufficient privileges to create the database.

To resolve this issue

An administrator must initiate the first load test run to force the creation of the load test results database. 

1.57   Visual Studio 2005 Team Edition for Testers: Load Test Results Stored in SQL Express might not be Accessible from Remote Computers 

The SQL Express configuration and the Windows Firewall might block remote access to load test results stored in SQL Express. A default installation for SQL Express disables remote access to the database. Load Controller setup automatically sets the SQL Express configuration and the Windows Firewall configuration to allow remote access to SQL Express. However, setup on makes these configuration changes if it also installs SQL Express. Visual Studio setup can also install SQL Express but does not automatically change the SQL Express and Windows Firewall configuration to allow remote access.

The following message is displayed when the load test results viewer is unable to remotely access to a load test result in SQL Express:

"Could not read result repository: Could not access the load test results repository: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections."

To resolve this issue

Manually configure SQL Express and the Windows Firewall to allow remote access. Use the following steps to enable remote access to SQL Express:

1. Open the SQL Server Configuration Manager by clicking Start, All Programs, Microsoft SQL Server 2005, Configuration Tools, SQL Server Configuration Manager.
2. In the left pane of the SQL Server Configuration Manger, expand the node for SQL Server 2005 Network Configuration and select Protocols for SQLEXPRESS.
3. In the right pane, right-click Named Pipes and choose Enable.
4. Right-click TCIP/IP and choose Enable.
5. In the left pane, select SQL Server 2005 Services.
6. In the right pane, right-click SQL Server Browser and choose Properties.
7. Click the Services tab in the Properties dialog box.
8. On the Services page, set the Start Mode property to Automatic and click OK.
9. Right-click SQL Server Browser and choose Start.
10. Right click SQL Server (SQLEXPRESS) and choose Restart.

Use the following steps to configure the Windows firewall.

1. Open the Windows Firewall dialog box and click the Exceptions tab.
2. Click Add Program and Browse to find sqlbrowser.exe and click OK.
3. Click Add Program and Browse to find sqlservr.exe. Click OK.
4. Click Add Port and enter “SQL Service” for Name, 1433 for Port number, and select the TCP radio button.
5. Click OK on the Windows Firewall dialog 

1.58   Interop support of Long (VT_I8) is limited to WinXP 

Latebound calls on Win2K or Win9x passing a Long (VT_I8) will fail. WinXP is the only supported platform for VT_I8 through OLE automation.

To resolve this issue

Use integer rather than long. 

1.59   EnvDTE80.WindowKinds.vsWindowKindImmediate constant is incorrect 

The vsWindowKindImmediate constant will not return the correct GUID for the Immediate window

To resolve this issue

Use the following GUID in place of the vsWindowKindImmediate constant: {ECB7191A-597B-41F5-9843-03A4CF275DDE}
Alternatively, the following will get the correct Immediate Window GUID:
    DTE.Windows.Item("Immediate Window").ObjectKind 

1.60   Shared Add-in wizard Setup project will not work on a computer that only has Microsoft Office 

Add-ins for Office require Extensibility.dll in order to run, which is not automatically included in the Setup project for Shared Add-ins.

To resolve this issue

In the Solution Explorer, right-click on the Add-in Setup project and select Add | Assembly. In the .NET tab, select Extensibility and press OK. Once the assembly is added, select it in the Solution Explorer and ensure that the “Register” property is set to “vsdraDoNotRegister” 

1.61   Fonts and Colors options are not reflected immediately upon reset. 

A reset of environment settings can be performed by clicking Tools > Import and Export Settings... and choosing "Reset all settings". A reset of environment settings can also be performed by issuing the command "Tools.ImportAndExportSettings /reset" inside the Command Window. In either case, the fonts and colors options are not reflected until a restart of Visual Studio.

To resolve this issue

After performing a reset operation, restart Visual Studio. 

1.62   Application Verifier is not supported for DLL based projects, ATL web service projects, and VC Smart Device projects . 

Application Verifier is not supported for the following scenarios:
1. Using Start With Application Verifier on a DLL project and loading it in an executable that is not part of the solution.
2. Changing theCommandin Project Properties | Debugging to something other than the currently loaded project ($TargetPath). This applies to remote debugging as well.
3. Application Verifier is not supported for ATL web service projects as these run under a different process.
4. Application Verifier is not supported for VC Smart Device projects as these run under a different architecture.
Application verifier is enabled only for the exe projects loaded in the IDE.

To resolve this issue

For scenarios 1 & 2 above, load the project of the target executables in the IDE and then use Application Verifier. Using Application Verifier in all the above cases will work the same as a normal debug session (Debug | Start). 

2. .NET Framework

2.1   Manual test files with DBCS (double-byte character set) are not displayed properly when running. 

When you run a manual test file with DBCS in the name, you will see the manual test result window. However, the manual test is not displayed properly in that window. If you right-click on the lower section of the window, and select Refresh, the section will hang for a few minutes and then turn blank.

To resolve this issue

Use SBCS (single-byte character set) to name your manual test files. If you want, you can use "DBCS" in the description of the manual tests.

 

2.2   Wrong version of msvsmon.exe gets launched on 64-bit computer running 32-bit Visual Studio 2005 and SQL Server 2005. 

SQLCLR debugging will fail on a 64-bit computer, when Visual Studio 2005 (x86) and SQL Server 2005 (x86) are installed. The following message is displayed:

---------------------------
Microsoft Visual Studio
---------------------------
Unable to debug .NET code. Could not attach to SQL Server process on ' The 64-bit version of the Visual Studio Remote Debugging Monitor (MSVSMON.EXE) cannot debug 32-bit processes or 32-bit dumps. Please use the 32-bit version instead.
---------------------------
OK
---------------------------

The 64-bit version of msvsmon.exe gets launched automatically because the operating system on the computer is 64-bit. The 32-bit version should be launched instead because both applications are 32-bit. This is an architectural problem that can not be fixed at this point.

To resolve this issue

The user can manually launch the 32-bit version of msvsmon.exe when trying to do SQLCLR debugging on the local computer.

It is not recommended that the 32-bit version of msvsmon.exe be registered to launch automatically, because this would break other 64-bit debugging scenarios. 

2.3   AuthorizationStoreRoleProvider: Incorrect or obscure errors are returned from Authorization Manager 

The AuthorizationStoreRoleProvider depends on Authorization Manager. Not all error messages returned from AuthorizationManager indicate the root cause of a problem. Listed below are error messages that are known to be either incorrect or vague.

"COMException (0x8007052b): Unable to update the password. The value provided as the current password is incorrect."
This error is really an access denied error. If all of the following conditions are met, this error can occur: ASP.NET is deployed on IIS 5.0, Windows XP IIS 5.1, or in IIS 5.0 isolation mode on Windows Server 2003, the application is configured to use Integrated Windows Authentication, and the policy file is located inside of the directory structure of the current ASP.NET application. If ASP.NET is running as a local computer account and attempts to access a policy store in a remote AD or ADAM instance this error can also occur.

"More data is available"
This error really means that the policy store could not be found. If the connection string points at an ADAM instance, but the connection string references an ADAM partition that does not exist, this error can occur. For example, in the following connection string “LDAP://localhost:4000/Cn=storename, DC=Partition1”, if Partition1 does not exist in the ADAM instance, this error will occur.

"The specified server cannot perform the requested operation"
This error really means that the specified server could not be found. If the connection string points at a non-existent server, or uses a port number that AD or ADAM are not listening on, this error can occur.

"ArgumentException: The parameter is incorrect"
This error message really indicates that an LDAP query group in Authorization Manager used to determine if a user is in a role is invalid.

To resolve this issue

For each error condition listed above, review the possible causes. If an application's configuration matches one of the possible causes, change or fix the application's configuration based on the information listed above. 

2.4   SQL Server Express User Instances Should be Disabled on Shared Hosting Computers

ASP.NET 2.0 integrates with SQL Server Express 2005 to provide automatic creation of the database required by many of ASP.NET 2.0's new application services. This functionality relies on SQL Server Express' support for spawning server processes that run with the identity of either the interactive user or the identity of the worker process hosting ASP.NET. In un-trusted environments such as on a shared hosting server, the ability to spawn SQL Server worker processes should not be enabled due to the potential for unintentionally sharing data between ASP.NET applications.

To resolve this issue

If you are installing SQL Server Express using the standalone installer, you can use the advanced setup options to explicitly disable support for user instancing.

Alternatively you can manually disable user instancing for an existing SQL Server Express installation as follows:
1. While logged in as a local box administrator, open a command window by running cmd.exe
2. If osql.exe is not available from any directories listed in the PATH environment variable, change directories to the SQL Server Express directory that contains osql.exe.
3. Connect to the parent instance of SQL Server: osql –E –S .\sqlexpress
4. Issue the following Sql commands:
exec sp_configure 'show advanced option', '1'
go
reconfigure with override
go
exec sp_configure 'user instances enabled', 0
     go
reconfigure with override
go 

2.5   Persistent cookies for forms authentication now use the same timeout setting as session based cookies. 

In previous versions of ASP.NET, persistent forms authentication cookies had a hardcoded lifetime of 50 years. In ASP.NET 2.0 persistent form authentication cookies have their expiration date set to the current date time plus the value of the "timeout" attribute from configuration. By default this means persistent cookies will have a lifetime of 30 minutes. If you want a longer lifetime you will need to increase the value of the "timeout" attribute. In ASP.NET 2.0 this means that forms authentication tickets stored in both session-based and persistent cookies will use the new timeout value

To resolve this issue

If different timeout values are desired for persistent cookies, a developer can get a reference to the forms authentication cookie after initially setting the cookie with a method like FormsAuthentication.SetAuthCookie. A developer can then get a reference to the cookie with a call to: Response.Cookies[FormsAuthentication.FormsCookieName]. On the resultant HttpCookie a developer can then set the Expires property to a different value. 

2.6   Incorrect behavior of DeleteRole method on the AuthorizationStoreRoleProvider 

The DeleteRole method on the provider incorrectly throws an exception stating "Element not found" if an attempt is made to delete a non-existent role. The provider should be returning false instead. Also, if an attempt is made to delete a role that has existing users in it, the provider will return false instead of throwing an exception.

To resolve this issue

1. Wrap all calls to the provider's DeleteRole method inside of a try-catch block. This will ensure that any future fixes that re-enable exceptions when deleting populated roles will not impact existing code.
2. Check to see if the role exists prior to attempting to delete the role. 

2.7   ASP.NET Profile feature can fail when using Xml serialization and a non-default application identity 

The default property serialization mechanism for the ASP.NET Profile feature is Xml serialization. If the ASP.NET process identity is something other than ASPNET (on IIS 5.0 and IIS 5.1) or NETWORK SERVICE (for IIS 6), then the Xml serialization process will fail with an exception stating "InvalidOperationException: Unable to generate a temporary class." The same problem will occur if using application impersonation. These exceptions occur because the XmlSerializer writes temporary class files into the %windir%\temp directory. By default this directory only grants " List Folder/Read Data" permissions to the default ASP.NET accounts. Non-default ASP.NET accounts are able to write temporary files into this directory, but do not have the necessary privilege to subsequently find the temporary classes for use by the XmlSerializer.

To resolve this issue

For secure environments, developers should use a different serialization mechansim - either binary serialization or string serialization. For applications where the potential for accidentally sharing temporary class files across applications is not high, the worker process or application impersonation identity can be granted the "List Folder/Read Data" privilege on the %windir%\temp directory. 

2.8   ASP.NET Session State Limitations when using SSE 

SSE should only be used in development environments with ASP.NET Sql Server based session state because there is no Sql Server Agent service installed with SSE. As a result the session state cleanup job never runs and session state data will accumulate in the database. You can manually cleanup expired sessions by connecting to SSE and running the following command: "EXECUTE DeleteExpiredSessions".

To resolve this issue

Use one of the standard versions of Sql Server 2005 for production applications. 

2.9   AuthorizationStoreRoleProvider: Default value for ApplicationName results in an error from Authorization Manager. 

Authorization Manager does not allow the "/" character in application names. In the absence of applicationName being set in configuration, the AuthorizationStoreRoleProvider follows the same logic used by other ASP.NET providers to determine a default value for applicationName. When running within ASP.NET, this results in a value that starts with the "/" character.

To resolve this issue

Always set the applicationName attribute in configuration when using the AuthorizationStoreRoleProvider within an ASP.NET application. 

2.10   On Windows 98 and Windows ME, debugging an application that consumes a Web Service causes the application to hang 

In Visual Studio 2005, when debugging an application on Windows 98 or Windows ME that consumes a Web Service, the application hangs.

To resolve this issue

Disable the debugger component csm.dll, and use breakpoints to stop in the Web Service.

To disable csm.dll, please follow the instructions below:

1) On the Windows Start meu, select Run.
2) In the Run dialog, type regedit.exe.
3) Goto HKEY_CLASSES_ROOT\CLSID\{12A5B9F0-7A1C-4FCB-8163-160A30F519B5}.
4) Verify that you are on the right registry key by checking that InprocServer32\(default) has the value ' <drive>:\Program Files\Common Files\Microsoft Shared\VS7Debug\csm.dll'.
5) Delete the registry key (HKEY_CLASSES_ROOT\CLSID\{12A5B9F0-7A1C-4FCB-8163-160A30F519B5}).

2.11   C# Code Snippet shortcuts cannot contain non-spacing marks.  

C# Code Snippets are defined in XML within .snippet files. One of the possible tags in the schema is a <Shortcut></Shortcut> tag. Shortcuts can be used to quickly insert a snippet. To do so, a user simply needs to type the shortcut string and then press Tab.

Many unicode characters are allowed within shortcut strings, but non-spacing marks found in complex script languages are not recognized as valid shortcut characters. This means that some strings in complex script languages cannot be used as shortcuts. If a shortcut does contain a non-spacing mark, typing the shortcut string and pressing Tab will insert a Tab character but will not insert the snippet code.
Note: The snippet shortcut will still appear in IntelliSense.

To resolve this issue

1. Choose a Unicode shortcut name that does not contain a non-spacing mark.
2. Insert the snippet through the Snippet Picker UI instead of using shortcuts.

 

2.12   System.Net has removed the logic to time out a DNS resolve when the timeout is less than the timeout in the unmanaged API that is called by System.Net to perform the resolution. 

In previous versions of the .NET Framework, System.Net's DNS added timeout logic to the Dns type in order to circumvent the lengthy native timeout. Without an accurate DNS timeout, it is not possible to set accurate timeouts for other web requests. However, to implement this timeout, the DNS resolve is offloaded to a separate thread. If the thread pool level is low, the DNS resolve may wait for an available thread until it times out, resulting in an exception being thrown. To avoid this exception, the DNS timeout logic has been removed.

To resolve this issue

There is no known resolution.

2.13   SqlCacheDependency requires initialization with a call to System.Data.SqlClient.SqlDependency.Start 

Due to changes in how query notifications work with SQL Server 2005, developers must call the Start method on SqlDependency at least once prior to using SqlCacheDependency. A logical place to call Start is inside a web application's Application_Start method located in global.asax:

void Application_Start(object sender, EventArgs e)
{
System.Data.SqlClient.SqlDependency.Start("connection string");
}

The connection string must be the same one that will be used when issuing commands for use with SqlCacheDependency. 

2.14   System.Net no longer adds a CRLF character when calling WebClient.UploadValues()  

In previous versions of the .NET framework, calls to WebClient.UploadValues() would add a CRLF to the uploaded content resulting in server application failures. The CRLF characters violate the application/x-www-form-urlencoded content type encoding scheme, as described in the HTML 4.01 specification. The CRLF is no longer added.

To resolve this issue

Use WebClient.UploadData() to add the CRLF and recompile your application or fix the server application to not expect the CRLF character. 

2.15   UriBuilder no longer clears the Fragment or Query properties after they are set  

UriBuilder is a type that allows building a Uri instance piece by piece. In previous .NET Framework versions, Query properties and Fragment properties could not be set at the same time.  This error has been fixed in version 2.0. Query and Fragment properties are now set without having any fields inadvertently cleared. Applications that have worked around the previous behavior may need to adjust their logic to avoid erroneous behavior.

To resolve this issue

There is no known resolution. 

2.16   The permissions demanded before applying the values present in the system.net element of an application configuration file have changed.  

The permissions required to apply the settings present in the System.Net element of an application configuration file are changed from previous .NET framework versions. The permissions required to apply values from the configuration file are now the same as those required by the associated property when changing the setting in code.

To resolve this issue

There is no known resolution. 

2.17   Sending an FTP request followed by an FTP request over SSL (FTPs) to the same directory throws a file cannot be found exception 

If an application issues a FTP request to a server, and then issues another FTP request, with SSL enabled to the same server and path, the second request will fail. A file not found exception will be thrown. However, if the second request is not to the same path, the request will succeed. 

2.18   WebRequest.ServicePoint.Address demands unrestricted web permission only when the service point in question is a proxy server  

This new demand prevents applications running in partial trust from discovering network proxy addresses. Partially trusted applications using ServicePoint.Address API may get a SecurityException if the address points to a proxy server.

To resolve this issue

Use HttpWebRequest.Address 

2.19   Exceptions to Parity between 32-bit and 64-bit behavior for Visual Studio and .NET Framework 


1. Front Page Server Extensions for IA64 WOW64    

When using .NET Framework 1.1 to author a website on a remote IA64 computer running .NET Framework 1.1, FrontPage will not be a supported mechanism. Some basic functionality will work via the fileshare mechanism.

2. J# does not support running on native 64-bit. J# code can only run in WOW64 on 64-bit platforms.    

3. SQL Server Express is not supported on 64-bit for .NET Framework 2.0.

4. There are no peformance or scalability guarantees for high-load ASP.NET applications running on .NET Framework 1.1 in WOW64 for IA64.

5. Data breakpoints do not work with Visual Studio 2005 running on IA64 in WOW64.    

6. In Visual Studio 2005, the Edit and Continue debugger feature does not work on 64-bit

7. In Visual Studio 2005, VC ATL exceptions:    

- Build system doesn't register dlls targeting 64-bit on wow64

- Error ""%1 is not a valid Win32 application"" when debugging default ATL Server project on 64-bit computer.

- Executable to debug and URL are not prepopulated for ATL Server projects with 64-bit configurations

- Internet Explorer does not come up with .srf file specified by user when debugging 64-bit ATL Server project.

- Debugger type for ATL Server 64-bit configuration defaults to local windows debugger instead of web service debugger

- Debugging properties are not propagated to new configurations in a project. This means, for example, that if you start out with an ATLServer project in x86 and then create a 64-bit configuration for it, debugging will not work without changing the debuggee to be Internet Explorer.


8. There is no support for interop debugging (managed + unmanaged mixed-mode debugging) in 64-bit.

9. Some MDAs are not supported on 64-bit for example: Re-entrancy, LoaderLock, PInvokeStackImbalance

10. MMX intrinsic are not supported by the IA64 and x64 C++ compilers.

11. Inline assembly is not supported by IA64 and x64 C++ compilers.

12. Most High Level Language constructs are not supported by x64 MASM.
MASM does not support IA64, but we ship Intel's assembler (ias.exe)

13. In Visual Studio 2005, VC++ compiler switch /ARCH:SSE is not supported by x64 and IA64 VC++ compilers.

14. The System.Diagnostics.Process.MainModule and System.Diagnostics.Process.Modules APIs will fail if running under the WOW64 on a 64bit child process.

15. 32bit and 64bit COM+ serviced components with the same GUID/CLSID cannot be registered at the same time.

16. 64-bit SDK does not include native DBGCLR. DBGCLR will be WOW64 only.

17. 64-bit SDK does not include a native DEXPLORE.EXE. DEXPLORE.EXE will be WOW64 only.

18. There are no bootstrapper manifest packages for x64 and IA64

There is no 64-bit bootstrapper for ClickOnce or other applications. On any 64-bit computer that has .NET Framework installed, if you try to install a ClickOnce application, it fails with the message “This version of the .NET Framework 2.0 is not supported on a 64-bit operating system. Contact your application vendor.”

This even happens for applications that are authored as 32-bit only and would have run in WOW64.

19. Visual Studio 2005 does not install on IA64    

Visual Studio 2005 will not install on IA64 (no design time support for IA64). Visual C++ will have a native IA64 command line tools installer.

20. Only Visual Studio Team System will allow building applications that target IA64    


21.P/Invoke signatures with blittable types are treated differently on 64-bit because P/Invoke is implemented differently on 64-bit, hence there are cases where incorrect P/Invoke signatures that accidentially worked on 32-bit don't work on 64-bit.

22. Visual Studio 2005 Tools for Office is not supported on 64-bit.
 

2.20   When performing a refactoring operation in a C# web site, build errors may be reported when none actually exist 

In certain cases, when performing a refactoring command in a C# web site that contains no build errors, the user may get a warning indicating that the project or one of its dependencies does not currently build and that references may not be updated.
This dialog can be safely ignored by clicking on the Continue or Preview buttons. The refactoring will succeed and all references will be updated.

The following are examples of common project configurations in which this warning will be shown:
- Web projects migrated from previous versions of Visual Studio, which contain a global.asax file in the web directory and a global.asax.cs file in the App_Code directory.
- Web projects in which web pages reference web user controls which in turn reference types declared in the App_Code directory.

To resolve this issue

There is no known resolution.  However, the warning can be safely ignored. 

2.21   System.Net now registers a default FtpWebRequest implementation that may cause applications using their own FTP component to break  

Prior to .NET Framework version 2.0, applications could register a component to handle FTP requests using System.Net's extensible pluggable protocol framework. Components for handling different web requests are registered by associating the component with a specific URI prefix. Any web request that matches that prefix is then handled by that component. In .NET Framework 2.0, System.Net now supports an FtpWebRequest component that is registered by default for the “ftp:” prefix. Any applications that are registering for this prefix (prior to this release) could now be broken because the prefix (FTP) is already taken.

To resolve this issue

Update the application configuration file to remove the default FTP protocol component prior to registering your own FTP component:
<system.net>
<webRequestModules>
<remove prefix = “ftp:” />
</webRequestModules>
</system.net> 

2.22   In .NET Framework 2.0, GlobalProxySelection.Select behaves differently than in version 1.1 when an empty System.Net tag is present in the machine.config file  

In version 1.1 of the .NET Framework, specifying an empty System.Net element in the machine.config file, GlobalProxySelection.Select returns an empty web proxy instance indicating that no proxy is to be used. In version 2.0, the new default is that the system proxy settings (same as what is specified in Internet Explorer) will be used in this case.

To resolve this issue

Modify the machine.config file to disable the default proxy as shown below.
<system.net>
<defaultProxy enabled=”false” />
</system.net> 

2.23   System.Uri does not include the IPv6 scope ID with the host.  

In previous .NET Framework versions, if you created a Uri instance using an IPv6 address, the scope ID is always included with the host address. The scope ID refers to the index of a local network adapter, and has no meaning for a remote host. The scope ID also uses a '%' character in its syntax, which conflicts with the Uri escaping format of '%hh'. Including the scope ID in the host breaks System.Uri's ability to interoperate with other URI parsers and resolvers. In version 2.0, System.Uri no longer includes the scope ID with an IPv6 host in a Uri instance. System.Uri has also added a new property, DnsSafeHost, which will return the scope ID with an IPv6 host address.

To resolve this issue

Use Uri.DnsSafeHost which will return the scope ID with an IPv6 host address 

2.24   Specifying a cluster as a remote proxy through System.Transactions configuration may throw a TransactionException during cluster failover 

If a cluster is specified as a remote proxy in configuration by setting the DistributedTransactionManagerName to a cluster, a TransactionException may be thrown during cluster failover.

To resolve this issue

To specify a cluster as a remote proxy, use the Component Services MMC to configure MSDTC to use the cluster as the remote MSDTC. 

2.25   The message, "Microsoft C# 2005 IntelliSense has encountered a problem" can appear when performing various actions in the IDE. 


In certain cases, the message "Microsoft C# 2005 IntelliSense has encountered a problem. We are sorry for the inconvenience" can appear while performing various actions in the editor. The reason in most cases is there is a failure with retrieving the source data.

Some examples of actions that could trigger this message include:
- Renaming an external alias.
- Performing a "find all references" in a web project with no 'runat="server"' attribute.

This is a non-fatal condition. Clicking the send report button will allow a user to safely continue working as expected and no data will be lost.

To resolve this issue

There are two possible options to turn off display of all non-fatal error message from the C# language service. To do this, modify the registry under the registry path:

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\CSharp\Options\Editor]

(1) "Watson_ReportExceptions"=dword:00000001
Adding the following registry key with the specified value will disable error reporting completely.

Note: Using this registry key and turning off all non-fatal error messages from the C# language service can potentially prevent gathering feedback on scenarios not related to this failure.

(2) "Watson_DeferSendingUntilLater"=dword:00000000
Adding the following registry key with the specified value will turn of the display of the message but will continue to send feedback to Microsoft. The IDE will be unresponsive for a brief period as information is collected to send. 

2.26   NullReferenceException thrown trying to get the transaction's DistributedIdentifier during transaction promotion 

Attempting to get the DistributedIdentifier on a Transaction while the transaction is promoting may cause a NullReferenceException to be thrown.

To resolve this issue

There are two ways to work around this issue.

Ensure that access to the transaction is synchronized.

-or-

Ensure that the transaction has promoted before checking the the DistributedIdentifier property. 

2.27   ASP.NET Web Service proxies generated using Add Web Reference will all use the same URL taken from the configuration file even if the service has multiple endpoints with different URLs 

When adding a Web Reference in Visual Studio 2005, the URL of the service is automatically picked up from the AppSettings section in the configuration file. If the web service has multiple endpoints with different URLs, multiple proxy types will be generated but they will all use the same URL value taken from the configuration file.

To resolve this issue

There are two possibilities:
1. Edit the WSDL document and break out each service into a separate document.

-or-
2. Edit the configuration file to add a key for each Web service and then read the values out in your code using System.Configuration.ConfigurationSettings.AppSettings. Set the URL property on your proxy instances using these values. 

2.28   Support for Nullable<T> by default in generated ASP.NET Web Service proxies can break existing code when proxy is re-generated 

When importing a schema that contains the nullable="true" attribute for an ASP.NET Web Service, the generated proxy will contain Nullable<T> types, whereas previously the attribute was ignored. This change may cause design time or runtime breaks in applications.

To resolve this issue

Possible workarounds are to avoid regenerating your proxy types, to recompile your code using the new Nullable<T> pattern, or to change the schema to not use the nullable="true" attribute. 

2.29   Setting the Proxy property to null on a web service proxy instance does not cause the request to go directly to the server 

Setting the Proxy property to null on a web service proxy instance should force the request to bypass any web proxy server settings and go directly to the server. However, this functionality does not currently work. The null value will be ignored and any configured web proxy server settings will be used instead.

To resolve this issue

You can set the Proxy property on the underlying WebRequest directly by deriving from the proxy type and overriding the GetWebRequest method:

protected override WebRequest GetWebRequest(Uri uri)
{
WebRequest req = base.GetWebRequest(uri);
req.Proxy = this.proxy;
return req;

2.30   Using .NET Remoting and Runtime Serialization across different versions of the .NET Framework 

When exchanging data between an application running on one version of the .NET Framework and an application running on another version (using .NET Remoting or Runtime Serialization), exceptions may be encountered while serializing or desterilizing certain Framework types. These exceptions indicate that these types are incompatible across the different Framework versions – that is, it is impossible to send them from one version of the Framework to another.

.NET Framework 2.0 includes a technology called Version Tolerant Serialization that eliminates this problem. However, previous versions of the Framework still face this issue. Thus, a patch will be made available that adds some Version Tolerant Serialization capabilities to .NET Framework 1.1. This patch will require Service Pack 1. After installing the patch, an application running on the patched Framework will be able to communicate with an application running on .NET Framework 2.0 without encountering this versioning issue. There are no plans to provide such a patch for .NET Framework 1.0.

It is worth noting that Version Tolerant Serialization only addresses versioning when using Binary Serialization, either directly or through .NET Remoting. When using SOAP serialization (either directly through the SoapFormatter class or through .NET Remoting) across different versions of the Framework, the versioning issues discussed above may still be encountered.

To resolve this issue

To obtain this patch, please see the following Knowledge Base article: http://support.microsoft.com/?kbid=907262. 

2.31   Specifying a non default trace listener for System.Transactions tracing does not work in partial trust 

Specifying a specific trace listener for System.Transactions tracing in the configuration is not supported in partial trust and will cause an exception to be thrown.

To resolve this issue

The default trace listener is supported in partial trust, so if no listener is specified in configuration, the traces will be caught by the default listener and printed to debug.outputstring. These traces can be viewed in partial trust by using DBMon.exe. 

2.32   Date and Time calculations in Web Services or XML Serialization scenarios may be incorrect after migrating to .NET Framework 2.0 

.NET Framework 2.0 changes the way dates and times are written to and read from XML. This change mostly affects the following scenarios:
- Using times with an unspecified time zone or times in the UTC time zone
- Interoperability scenarios with 3rd-party software that writes out time values to XML without specifying a time zone or specifying the UTC time zone

The changes may cause certain date and time calculations and comparisons to become incorrect. In these cases, it may be necessary to revert to the earlier date/time behavior.

To resolve this issue

To revert to the earlier date/time behavior, apply the following configuration change:

<system.xml.serialization>
<dateTimeSerialization mode="Local" />
</system.xml.serialization> 

2.33   Windows User Profiles for ASP.NET Automatic Database Creation with SQL Server Express and IIS 

The ASP.NET automatic MDF creation process for SQL Server providers using SQL Server Express (SSE) and IIS only works when IIS is running either as the local ASP.NET computer account, or as NT AUTHORITY\NETWORK SERVICE. The automatic creation process also works when a developer is interactively developing using Cassini (i.e. file based webs). However, when developing against IIS using either a different local computer account, or a domain user account, the automatic database creation process will fail because these accounts do not have a Windows user profile available on the web server.

To resolve this issue

There is no resolution for this issue. Automatic database creation with SSE for IIS-based websites will only work for the ASPNET and NETWORK SERVICE accounts. 

2.34   Unicode Surrogate Behavior with ASP.NET Providers that use SQL Server 7.0 or 2000 

ASP.NET providers that use SQLServer are constrained to the level of Unicode surrogate support provided by SQLServer 7.0 and SQL Server 2000. SQL Server 7.0 and 2000 store and retrieve surrogate pairs losslessly. However, there is no linguistic comparison for surrogates. Surrogate characters are ignored during comparison operations and during uniqueness checks when using these versions of SQL Server. For example this means the SqlMembershipProvider will consider two usernames that only include surrogate characters to be identical. This behavior will lead to a uniqueness constraint violation if an attempt is made to create a second user with a username that differs from an existing user only in surrogate characters.

To resolve this issue

There is no known resolution for these versions of SQL Server. 

2.35   FileWebRequest.PreAuthenticate only returns false 

Types that inherit from WebRequest inherit a PreAuthenticate property. This property is used to enable sending authentication information along with the request without waiting for a challenge from the server. FileWebRequest does not support preauthentcation, so its PreAuthenticate property should always return false. In previous .NET Framework versions, if the PreAuthenticate property was set to true by an application, it would return true when its value was later queried. This is no longer the case. FileWebRequest's PreAuthenticate property will always return false.

To resolve this issue

Users should not use the PreAuthenticate property on FileWebRequest. 

2.36   Using generic types with .NET Remoting and SOAP Serialization 

The .NET Remoting technology supports both binary and SOAP serialization – that is, remoting messages may be represented in a Microsoft-specific binary format or as SOAP XML. However, generic types (which are a new feature in .NET Framework 2.0) may only be used with binary serialization. The usage of generics with SOAP serialization is not supported, neither through .NET Remoting nor by using the SoapFormatter class directly.

To resolve this issue

There is no known resolution for this issue. 

3. Smart Device Programmability

3.1   F11 into a DLL function is not working for X86 SmartDevice Project 

1. Create a Win32 smart device project Dll with a function DllFunc with any piece of code with this function exported by the dll targeting x86 platform.
2. Create a Win32 smart device project exe that does a LoadLibrary on this dll and invoked the DllFunc added to the same solution. Make sure this is set as the startup project.
3. Compile, Deploy and Debug the solution.
4. Try to step into (F11) into the DllFunc. F11 turns into F10 on this special DllFunc() gotten from GetProcAddress and only on x86 platform.

To resolve this issue

View DllFunc on the debugger window to get the hex address and then setting the breakpoint on the disassembly. 

3.2   Managed attaching to a native process does not return an error 

1. Create a native Console SmartDevice Project.
2. Hit Ctrl F5.
3. Select Tool \ Attach To Process.
4. Select the Smart Device Transport & your target device.
5. Select Managed debugger in the Debug engine selection dialog.
6. Select your native process & attach.
7. You will observe no messages.

To resolve this issue

There is no known resolution. 

3.3   Applying filter in break mode to an already existing breakpoint causes the breakpoint to be ignored. 


1) Create a Native application with the following code
void foo(void)
{        
}        

int _tmain(int argc, _TCHAR* argv[])
{
    int i = 0;

    foo();

    return 0;
}
2) Set a location breakpoint on "return 0;"
3) Set a function breakpoint on foo() at design time.
4) F10 to get the application into break mode.
5) Open the breakpoint window and edit the filter property of function breakpoint (by including the filter ProcessName or ThreadName)
6) Continue (F5)
7) The function breakpoint is not hit and instead we break at "return 0" statement.

The above scenario illustrates that modifying a design time breakpoint by editing the filter properties at break mode causes the breakpoint to be ignored.This is true for all kinds of breakpoints.

To resolve this issue
Set the breakpoint and apply the filter at design time itself. This applies only to ProcessName, ThreadName filters as ThreadId and ProcessId are not known at design time. 

3.4   In Native Debugging, F10/F11 translate into a step over the body of while loop and related constructs if the body of the loop construct spans on a single source line. 


F10/F11 do not work properly in scenarios illustrated by example below.

Example Code Snippet

1 int i = 0;
2 while (i < 1000) { i++; }
3 return 0;

Steps:
-Press F9 on line 1 and then after the breakpoint is hit on this line press F10
-Now the control is on line 2
-Press F10 yet again

The issue after performing the above steps is that the debugger would stop/break at line 3 and not at line 2. That is, the breakpoint on line 2 gets ignored for repeated F10.
Please note that this happens for all loop constructs that span a single source line.

To resolve this issue

Place a breakpoint with F9 on the source line with the while loop (line 2). Then the debugger would break at each F10 on line 2 while stepping through the while loop (till i increments to 1000) .

-or-

If code can be edited, re-organize the above code as follows and everything would work as expected.
    1 int i = 0;
    2 while (i < 1000)
    3 { i++; }
    4 return 0; 

3.5   Native assert dialogs for Smart Device applications may render buttons off the screen 

When an assert dialog is thrown by a Visual Studio 2005 C++ Smart Device application on a Pocket PC or Smartphone, the buttons on the dialog may render off the screen

To resolve this issue

Use the scroll buttons/keys of the Pocket PC or Smartphone to manually scroll to the button. 

3.6   "Copy if newer" Property semantics for Smart Device projects 

In smart device projects, newness of a dll or exe file is determined by comparing the Win32 versions.
- If the device-side version is less than that of the desktop, the file is copied.
- If the device-side version is greater than that of the desktop, the file is not copied.
- If the checksums are different, the file is copied.


Newness of files other than dll and exe is based solely on checksum.
Newness is not based on timestamp or size.

To resolve this issue

There is no known resolution. 

3.7   Visual Studio 2005 will connect to an ActiveSync device if there is an error connecting to a TCP/IP device.  

When one device (e.g. PPC) is connected through ActiveSync and you want to connect to a WinCE device (e.g. CEPC) through TCP/IP, if the TCP/IP connection to WinCE device fails for some reason, Visual Studio 2005 will connect to the device connected through ActiveSync.

To resolve this issue

Disconnect the device connected through ActiveSync before attempting TCP/IP connection to another device. 

3.8   Deploying an MFC dll with automation support and dynamically linked to MFC library will fail with the error 0x8007007e while registering. 

While deploying an MFC dll project with automation support and dynamically linked to MFC library, Visual Studio 2005 deploys the dll along with required dependent dlls to device under project folder. LoadLibrary() used for registering the dll looks for dependent libraries in the directory where conman components are located and then in \Windows directory. For this reason the dll registration fails.

To resolve this issue

Manually move or copy the required dependent dlls from the project folder to \Windows directory on the device. 

3.9   Connectivity to Device Emulator unstable when using wireless networks that have DHCP servers configured with short lease times 

On wireless networks, TCP/IP connectivity to the device emulator through Virtual Switch driver could be unstable. This is caused by the interaction of the DHCP server implementation, the Virtual Switch driver, and the 802.11 specification.

To resolve this issue

For stable connectivity to device emulator one of the following transports could be used.
1. DMA transport

-or-
2. TCP/IP transport over loopback adapter. 

3.10   MUI: Localized remote tools fail to connect to device emulator when run under non-matching system locale 

When a localized version (e.g. Japanese) of Visual Studio 2005 is installed on a English MUI OS, remote tools will fail to connect to the device emulator. This is because remote tools always use the system locale. For the same reason, when two different locales of Visual Studio 2005 (e.g. Japanese and English) are installed side-by-side on a English MUI OS, remote tools will always connect to the English device emulator.

To resolve this issue

Change the system locale to match the Visual Studio 2005 locale. 

3.11   Debugging experience sometimes is bad with default project settings for SmartDevice VC++ applications since /Os complier option is set. 


The default project settings of SmartDevice VC++ Project has the compiler optimization option /Os set. /Os (Favor Small Code) minimizes the size of executable files and DLLs by instructing the compiler to favor size over speed. This could result in a bad debugging experience at times due to the code generated for this setting. For example, the debugger could enter both the if and else statements while stepping.

To resolve this issue
Modify the compiler optimization setting "Favor Size or Speed property" from /Os option to Neither.
Steps
1) Open the project's Property Page dialog box.
2) Click the C/C++ folder.
3) Click the Optimization property page.
4) Modify the "Favor Size or Speed" property to Neither.

This would achieve a better debugging experience. However the size of the executable would increase a little.  

3.12   Build Errors when Compiling a Compact Framework 1.0 Application that has a form marked for Localization. 

If you are developing an application that requires to be localized and is targetting Version 1.0 of the Compact Framework, you will get an error about the missing SDK.

Message:
"Localization of projects targeting .NET Compact Framework 1.0 requires version 1.1 of the .NET Framework SDK, which is not detected on this machine."

To resolve this issue

Version 1.1 of the .NET Framework SDK does not ship inside the Visual Studio 2005 product. It needs to be downloaded and installed.

Use this page to download the SDK from.
http://msdn.microsoft.com/netframework/downloads/updates/default.aspx  

3.13   Drag-n-Drop of SqlCEResultSet DataSource does not generate code for the controls in the designer code file 

Drag-n-Drop a SqlCEResultSet DataSource from the DataSource window on a device windows forms designer does not generate the code for the controls in the designer code file (e.g. Form1.designer.cs).
This will occur as follows:
1. Control generation option set to DataGrid: Code for creating and initializing the DataGrid will not be generated in the designer code file.
2. Control generation option set to Details: Code for creating and initializing the controls in the Details View will not be generated in the designer code file.

To resolve this issue

Any one of the following are sufficient:
1. Before Drag-n-Drop: Edit any property of the form either from the Properties window or from the context menu on the design surface.
E.g. Right-Click on design surface and turn off "Show Skin". Repeat to turn "Show Skin" back on.

-or-
2. Before Drag-n-Drop: Add any control to the form from the Toolbox.

-or-
3. After Drag-n-Drop: Edit any property of the form either from the Properties window or from the context menu on the design surface.

-or-
4. After Drag-n-Drop: Add any control to the form from the Toolbox. 

3.14   Deploying an MFC ActiveX control which is dynamically linked to MFC library will fail with the error 0x8007007e while registering. 

LoadLibrary() API used for registering the ActiveX control looks for dependent libraries in the directory where conman components are located and then in \Windows directory. For this reason the ActiveX control registration fails.

To resolve this issue

Copy the required MFC dlls to \Windows directory on the device. For example, if Visual Studio 2005 is installed on C: drive, MFC dlls for armv4 processor could be found under C:\Program Files\Microsoft Visual Studio 8\VC\ce\Dll\armv4. 

3.15   One or more static text controls in a device project does not appear at run time. 

When dialog based MFC applications are executed on smart devices, one of the static text controls does not appear at run time on the device. The reason might be one of the following.

1. Use of wizard generated code for creating a MFC based dialog application for smart devices and the dialog contains more than one static text control  added by the developer.
-or-
2. The custom developed code for VC++ application targetting smart devices contains support for "Resolution Awareness.

To resolve this issue
When wizard generated code for a dialog based MFC application targeting smart devices is used, by default the wizard generates code for a "Resolution Aware" application. The resolution aware application uses the DRA(Device Resolution Aware) APIs. The generated code calls the API DRA::RelayoutDialog() in order to support the landscape and portrait modes.

The API DRA::RelayoutDilog() requires that each of the static text controls must have unique IDs. However by default when the developer adds static text controls by drag and drop on the form, all the IDs for static text controls are generated as IDC_STATIC.

To get all the controls displayed at run time, modify the IDs for these static text controls as IDC_STATIC_1, IDC_STATIC_2, IDC_STATIC_3,..and so on, making them unique IDs. This will ensure that all the static text controls appear at run time for the "Resolution Aware" applications.

In order to change the ID of a static text control,

1. Select the control on the form.
2. right click and select properties.
3. Select the "ID" Property.
4. Change IDC_STATIC to a unique identifier as for example IDC_STATIC_2,IDC_STATIC_3 and so on for every static text control.

For a complete description of DRA::RelayoutDialog() refer to

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/screen_orientation_awareness.asp
 

3.16   Smart device Winsock server running on a device receives OnConnect callback notification. 

The smartdevice socket server implementation has a OnConnect() and OnAccept() method implemented using CSocket or CAsyncSocket targeting WinCE. When a client establishes a connection to this server hosted in the device, the server receives both OnAccept() and OnConnect() notifications.

To resolve this issue

In order to avoid receiving the OnConnect() notification in the server do the following

Before the call to Accept() on the server socket

1. Call AsyncSelect method using the events that the server socket is subscribed to. That is if "socket" is the object for the server socket then
    socket.AsyncSelect(FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CLOSE);
Note that all the events are used other than the FD_CONNECT to explicitly mask the Connect event in the sever.

2. If there is a need for the server socket to mask other events then, use the list of specific events that the server socket is interested in, for example if the server socket intended not to receive events for read operation then remove FD_READ also from the list of events in the call to AsynchSelect method as 
    socket.AsyncSelect(FD_WRITE | FD_OOB | FD_ACCEPT | FD_CLOSE);

masking FD_CONNECT and FD_READ events.

Please refer to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_casyncsocket.3a3a.asyncselect.asp
for a complete description of ASyncSelect method behavior. 

3.17   eVC4Project can not be opened in Visual Studio 2005 by double-clicking on .vcw file. 

The developer has a device project created using eVC4.  After the installation of Visual Studio 2005 he is trying to open the eVC4 project in Visual Studio 2005 by double clicking on the eVC4 workspace file "project.vcw".

To resolve this issue

The standard eVC4 projects are not registered as Visual Studio 2005 projects.  In order to convert these eVC4 projects into Visual Studio 2005 compatible solution files do the following:

1. Open Visual Studio 2005.
2. From the File | Open , click on Project/Solution.
3. In the Open Project dialog box, navigate to the vcw file, select the file, and click open.
4. Select "Yes" for convert and open this project question. 

3.18   Marshalling Structures on devices returns "NotSupportedException" if Structure contains reference types.


In a Devices project, the SizeOf statement in the code below will throw a NotSupportedException:

Imports System.Runtime.InteropServices.MarShal
Module Module1
Structure S1
Public RefType As String
End Structure
Sub Main()
Dim sz As Integer
Dim struct As New S1
struct.RefType = "strings are reference types"
sz = SizeOf(struct)
End Sub
End Module
 

To resolve this issue

Apply an attribute to the reference type so it's marshalled correctly. Here's an example:
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=3)> Public x As String

For more information, please read the documentation on the 'MarshalAsAttribute'.

3.19   'Save As' does not display the path selection dialog box on x86 or SH4 platforms.
 

When we click the wizard generated 'Save As' option from the application menu ( File > Save As ) in a native MFC project, the 'Save As' dialog box does not appear.

To resolve this issue

Use the 'GetSaveFileName' function in the common dialog box library.
For example to create a filename for a CWinApp derived class, you must:
 

Create a message map entry and register your handler for ID_FILE_SAVE_AS command.
This can be done in the following manner:
- Using IDE:
    1. Right Click on the 'Save As' menu item. Select 'Add Event Handler' option.
    2. Fill in the name, description of the handler. Select the class with which to associate the handler.
    3. Now select 'Add and Edit' option to create the appropriate entries. The code that needs to be written
     in the handler has been discussed below.

- Editing the source files.
    1. Add a entry of type ON_COMMAND(ID_FILE_SAVE_AS, your_handler) between BEGIN_MESSAGE_MAP and END_MESSAGE_MAP macros.
    2. Add the handler as 'afx_msg void your_handler();' in the heading file for the appropriate class.
    3. Implement this function as a member function to this class in the source using the ideas given below.

- The code for the handler should do the following things, in order:
    1. Declare a OPENFILENAME structure and initialize the appropriate fields( See the documentation on OPENFILENAME.)
    2. Call the GetSaveFileName function with this a reference to this structure.
     This throws up the filename selection dialog.
    3. The 'lpstrFile' field of the structure contains the filename that was selected using the path selection dialog box.

- The handler can use this selected name for further use.
 

3.20   In native debugging, F11 does not work for class constructors on x86  


Stepping into a constructor call in native debugging does not work when targeting a CEPC x86 device.

Example:
class Foo
{
private:
int i;
public:
Foo()
{
    i = 0;
}    
};

int _tmain(int argc, _TCHAR* argv[])
{
    Foo *f = new Foo(); // F11 on this statement should step into the constructor but instead a "No source available. Show Disassembly?" window pops up.
    return 0;
}

Please note that this issue is applicable only to x86 architectures.
 

To resolve this issue


Set a breakpoint directly in the constructor and then press F5.  The code in the constructor needs to be debugged on x86 device.
 

3.21   Incorrect message while deploying a CAB file to a device or emulator that has missing wceload.exe 

Wceload.exe performs installation tasks for .cab files on Pocket PC and Smartphone.
Deployment of a .cab file to a device or emulator with missing wceload.exe will fail with the message, "The system cannot find the file specified".

To resolve this issue

Manually copy the matching wceload.exe to device under \Windows directory.

 

3.22   Intermittent connectivity loss while deploying or debugging an application on device emulator using TCP transport over Virtual Switch driver.  

This happens due to an issue with Virtual Switch driver.

To resolve this issue

For stable connectivity to the device emulator use DMA transport. 

4. Source Code Control Integration

4.1   Renaming a folder under FrontPage Source Code Control causes files underneath to become uncontrolled 

If you are working on a remote web site that uses FrontPage versioning control and you rename a folder with source controlled items inside, all items in that folder will appear uncontrolled until you close and re-open your web site.

To resolve this issue

Close and re-open your web site after renaming the folder 

4.2   If you open a solution from source control that contains a multi-level IIS web, you might need to add read permissions for IIS to the parent folders in the web in order to debug 

When you open a solution from source control that contains IIS web sites, VS only grants IIS read access to the target path of your URL. However, in order to debug IIS web sites, IIS needs read access to each folder in the virtual path of the URL. So if you open a solution that contains a web site with more than one level (e.g. http://localhost/MyWebs/Web1), you might need to grant read access to IIS on whatever folder your parent web (e.g. http://localhost/MyWebs) points to in order to debug the web site.

To resolve this issue

In Windows Explorer, add "Read" permissions for the ASP.NET user account to the parent folders in your URL. And if you are using Windows Server 2003, the NETWORK SERVICE account also requires read permissions to the folder. For example, if you open a solution from source control containing "http://localhost/MyWebs/Web1", navigate in Windows Explorer to the directory that "http://localhost/MyWebs" points to and add permissions to this folder. Or, you can choose to open your solution to a different location on your computer where the Users group has read access (By default, the My Documents directory and its subfolders do not grant read access to the Users group).

5. Crystal Reports
For additional information concerning Crystal Reports for Visual Studio 2005, please visit us at: http://www.businessobjects.com/products/reporting/crystalreports/net/vsnet.asp

 6. Microsoft Visual Studio 2005 Tools for the Microsoft Office System

6.1   Visual Studio Tools for Office does not support multipart XML schemas 

Visual Studio Tools for Office only supports XmlMaps that are based on a single primary schema, even though Microsoft Office Excel supports XmlMaps that can be composed of a primary schema and optional supporting schema.

To resolve this issue

There is no known resolution. 

6.2   WordDynamicControls sample does not load controls when reopened 

When using the WordDynamicControls sample, adding controls and then closing and reopening the document will sometimes result in the added controls not being saved.

To resolve this issue

There is no known resolution. 

6.3   Both VBA and XLM (Excel 4.0 Macro) code runs when a workbook opens in the designer  

If you have Visual Basic for Applications (VBA) or Excel 4.0 Macro (XLM) code in your workbook event handlers, the code will be executed while the workbook is open in the designer.

To resolve this issue

To ensure that no VBA or XLM code runs while you customize your workbook using Visual Studio Tools for Office, you should remove any VBA or XLM code associated with your workbook before creating a project based on your workbook. 

6.4   Installing Visual Studio Team System on a computer with only Microsoft Office XP installed causes security dialogs to be displayed when Word or Excel is started 

When you start Word or Excel after installing Visual Studio Team System on a computer with only Office XP installed, the following Office security dialog will be displayed:

VSTOWordAdaptor.dll [or VSTOExcelAdaptor.dll]
contains macros by
Microsoft Corporation

Macros may contain viruses. It is always safe to disable macros, but if the macros are legitimate, you might lose some functionality.

The security level is set to High. Therefore, you cannot enable macros from sources that you do not trust.
[] Always trust macros from this source.

[Disable Macros] [Enable Macros] [More Info]

This warning is shown because the Microsoft signature used to sign VSTOWordAdaptor.dll and VSTOExcelAdaptor.dll is not on the list of trusted signatures in Office XP. The Microsoft signature is on the list of trusted signatures in Office 2003.

To resolve this issue

Trust macros from Microsoft Corporation. If you plan to use Visual Studio 2005 Tools for Office you must install a supported version of Office 2003. Installing Office 2003 will add this Microsoft signature to the list of trusted signatures. 

6.5   Removing a table from a dataset when there are bindings to it can cause components from the component tray to be removed when you debug the application 

This issue occurs when you remove a data-bound host control, such as a list object, from the design surface and then remove the table it was bound to from the data source using either the edit feature or the Data Source Configuration Wizard. If you then add a new host control and debug the application, an exception might be generated. When you stop debugging, the design surface is unloaded and data components are removed from the component tray.

To resolve this issue

If you remove a host control from the design surface and then remove the table it was bound to from the data source, you must manually remove the table’s binding source before building the application.

 

6.6   Windows Forms control extender properties do not appear for English Excel if the Windows user locale is set to a language other than English 

This issue affects the English version of Excel if the Windows user locale is changed to a language other than English. Certain properties, such as height and width, are not available for Windows Forms controls hosted on the Excel design surface.

To resolve this issue

Install an Office Multilingual User Interface (MUI) pack onto the system. It is not necessary to change the Excel user interface language. 

6.7   Word does not load Visual Studio Tools for Office customizations when the document is opened through HTTP and "Browse in same window" is not selected in Windows Explorer 

The “Browse in same window” property is used by Internet Explorer to determine whether the document is hosted inside the browser or in a separate window. If the document is hosted in a separate window, the customizations do not load and run.

To resolve this issue

Select "Browse in same window" in Windows Explorer.
To locate the "Browse in same window" property:
1) Open Windows Explorer.
2) Click the Tools menu.
3) Click Folder Options.
4) Click the File Types tab.
5) Select DOC in the list of registered file types.
6) Click Advanced. 

6.8   Source code control does not check out required related files when a Visual Studio Tools for Office document is checked out 

When you check a Visual Studio Tools for Office document out of source code control, not all of the required files are automatically checked out. This is because generated code is stored in files that are separate from the user interface (UI) control and data component properties of the document.

Changes that were indirectly made to the dependent files will be lost when the document is checked in, because the dependent files were never checked out and so could not be updated.

If only the document is checked out and there is a newer version of the related files on the server, you will not see the latest properties. The properties in the related files on the server will be overwritten if the related files are checked in with the document.

To resolve this issue

Before modifying a checked-in document, make sure to check out all of the related files. When checking in the document, remember to check in all the related files. These files are visible in Solution Explorer, indented beneath the document, when "Show All Files" is selected. 

6.9   Word templates open in Normal view, not Print Layout view, so non-inline controls are not displayed 

Objects in Word that are not inline with text are visible only in Print Layout view. By default UI controls added to a Visual Studio Tools for Office document are inline with text. The layout type can be changed by right-clicking the control, clicking “Format Control…” and then clicking “Layout”.

By default, Visual Studio Tools for Office opens Word Templates in Normal view so non-inline controls do not appear.

To resolve this issue

Switch from Normal view to Print Layout view to display the controls. 

6.10   Deleting a control from an inactive Excel sheet at design time might leave auto-generated code behind 

Each worksheet has its own design surface that is loaded on demand. When changes are made to the worksheet, for example, controls are added, deleted, or changed, the design surface detects those changes and updates the generated code.
If, at design time, controls are deleted from an inactive sheet, the generated code can only be partially updated because the design surface has not been instantiated. There are at least two ways this could happen. First, the “Manage Named Ranges” dialog is used to a delete a Named Range control from an inactive sheet. Second, the Excel document is opened outside Visual Studio, controls are then removed, and then the document is re-opened inside Visual Studio.

To resolve this issue

Activate the worksheet before using the “Manage Named Ranges” dialog to delete a Named Range control.
To repair build errors, make each affected sheet dirty by editing a property, adding a control to the surface, or deleting a control from the surface. Then rebuild the project. 

6.11   Visual Studio Tools for Office does not natively support 64-bit applications 

By default Visual Studio Tools for Office and other project types generate to “Any CPU” type. However, Visual Studio Tools for Office solutions only work in a 32-bit environment.

To resolve this issue

To run Visual Studio Tools for Office solutions on a 64-bit computer you must change the platform target in the project properties from “Any CPU” to x86, even if you will deploy the application on a 64-bit Windows operating system. You must also make this change to other types of applications, for example console or Windows Forms applications, that use the Server Document class. 

6.12   Visual Studio Team System unit testing is not supported in Visual Studio Tools for Office projects 

The unit testing feature, found in the Visual Studio Team System products, is not supported in Visual Studio Tools for Office.

To resolve this issue

There is no known resolution.

Microsoft Visual Studio 2005 Setup Issues

1. All Visual Studio Products

1.1. System Requirements

System Requirements for Installing Visual Studio 2005

Processor Minimum:
  • 600 megahertz (MHz) Pentium processor

Recommended:

  • 1 gigahertz (GHz) Pentium processor recommended
Operating System Visual Studio 2005 can be installed on any of the following systems:
  • Microsoft® Windows® 2000 Professional SP4
  • Microsoft® Windows® 2000 Server SP4
  • Microsoft® Windows® 2000 Advanced Server SP4
  • Microsoft® Windows® 2000 Datacenter Server SP4
  • Microsoft® Windows® XP Professional x64 Edition (WOW)
  • Microsoft® Windows® XP Professional SP2
  • Microsoft® Windows® XP Home Edition SP2
  • Microsoft® Windows® XP Media Center Edition 2002 SP2
  • Microsoft® Windows® XP Media Center Edition 2004 SP2
  • Microsoft® Windows® XP Media Center Edition 2005
  • Microsoft® Windows® XP Tablet PC Edition SP2
  • Microsoft® Windows Server™ 2003, Standard Edition SP1
  • Microsoft® Windows Server™ 2003, Enterprise Edition SP1
  • Microsoft® Windows Server™ 2003, Datacenter Edition SP1
  • Microsoft® Windows Server™ 2003, Web Edition SP1
  • Microsoft® Windows Server™ 2003, Standard x64 Edition (WOW)
  • Microsoft® Windows Server™ 2003, Enterprise x64 Edition (WOW)
  • Microsoft® Windows Server™ 2003, Datacenter x64 Edition (WOW)
  • Microsoft® Windows Server™ 2003 R2, Standard Edition
  • Microsoft® Windows Server™ 2003 R2, Standard x64 Edition (WOW)
  • Microsoft® Windows Server™ 2003 R2, Enterprise Edition
  • Microsoft® Windows Server™ 2003 R2, Enterprise x64 Edition (WOW)
  • Microsoft® Windows Server™ 2003 R2, Datacenter Edition
  • Microsoft® Windows Server™ 2003 R2, Datacenter x64 Edition (WOW)

 Installation of Visual Studio 2005 on the Intel Itanium (IA64) is not supported.

RAM1 Minimum:
  • 192 megabytes (MB)

Recommended:

  • 256 MB
Hard Disk2 Without MSDN:
  • 2 GB of available space required on installation drive
  • 1 GB of available space required on system drive

With MSDN:

  • 3.8 GB of available space required on installation drive with a full MSDN install or
    2.8 GB of available space required on installation drive with a default MSDN install.
  • 1 GB of available space required on system drive
CD or DVD Drive Not required
Display Minimum:
  • 800 x 600 256 colors

Recommended:

  • 1024 x 768 High Color - 16-bit
Mouse Microsoft mouse or compatible pointing device

Notes

  1. Performance has not been tuned for minimum system configuration. Increasing your computer's RAM will improve its performance, especially when running multiple applications, working with large projects, or doing enterprise-level development.

    For Visual Studio Tools for Office features, 256 megabytes of RAM is required. This requirement only applies to Microsoft Visual Studio 2005 Team Edition for Software Architects, Microsoft Visual Studio 2005 Team Edition for Software Developers, Microsoft Visual Studio 2005 Team Edition for Software Testers, and Microsoft Visual Studio 2005 Team Suite.
     
  2. When you start the Visual Studio 2005 installer, the default installation location is your system drive, which is the drive that boots your system. However, you can install the application on any drive. Regardless of the application's location, the installation process installs some files on your system drive. Consequently, ensure that the above amount of space is available on your system drive regardless of the application's location, and ensure that additional space, as listed above, is available on the drive on which you install the application.
1.2. Uninstalling Previous Versions of Visual Studio 2005

If you have installed previous versions of Visual Studio 2005, such as Beta 2 or Community Technical Preview (CTP) builds of Visual Studio Team Suite, Visual Studio Standard or Visual Studio Professional, then you must uninstall in the exact order shown below before beginning to install any version of Visual Studio 2005:

  1. Go to the Control Panel and launch Add/Remove Programs
  2. Remove "Microsoft SQL Server 2005 Express Edition"
  3. Remove "Microsoft SQL Server 2005 Tools Express Edition"
  4. Remove "Microsoft SQL Native Client"
  5. Remove "Microsoft Visual Studio 64bit Prerequisites Beta" (This step is needed only if Visual Studio is installed on a 64-bit machine)
  6. Remove "Microsoft Visual Studio Tools for Office System 2005 Runtime Language Pack" (This step is not needed if you have only the English Edition)
  7. Remove "Microsoft Visual Studio Tools for Office System 2005 Runtime Beta"
  8. Remove "Microsoft Device Emulator 1.0 Beta"
  9. Remove "Microsoft .NET Compact Framework 2.0 Beta"
  10. Remove "Microsoft .NET Compact Framework 1.0"
  11. Remove "Microsoft Visual Studio 2005 Professional" or other related IDE installs such as (Visual Studio Professional/Standard/Enterprise Architect/Team Suite, etc.)
  12. Remove "Microsoft Document Explorer 2005 Language Pack" (This step is not needed if you have only the English Edition)
  13. Remove "Microsoft Document Explorer 2005" (This step is needed for post-Beta2 builds)
  14. Remove "Microsoft SQL Mobile 2005 Development Tools"
  15. Remove "Microsoft 64-bit SDK" (This step is only needed if Visual Studio is installed on a 64-bit machine)
  16. Remove "Microsoft Visual Studio 2005 Remote Debugger (x64)" (This step is needed only if Visual Studio is installed on a 64-bit machine)
  17. Remove "Microsoft MDAC 2.8 SP1" (This step is needed only if you are running Windows 2000)
  18. Remove "Microsoft MSXML 6 SDK and Parser"
  19. Remove "Microsoft Visual J# .NET Redistributable 2.0 Beta Language Pack" (This step is not needed if you have only the English Edition)
  20. Remove "Microsoft Visual J# Redistributable Package 2.0 Beta"
  21. Ensure all Visual Studio 2005 products have been removed from your system
  22. Remove "Microsoft .NET Framework 2.0 Beta Language pack" (This step is not needed if you have only the English Edition)
  23. Remove "Microsoft .NET Framework 2.0 Beta"
Notes:
  1. If you see an error removing J# .NET Redistributable Package 2.0 from Add/Remove Programs, please run "msiexec /x {9046F10C-F5E7-4871-BED9-8288F19C70DF}" from a command line window<
     
  2. If you see an error removing .NET Framework 2.0 from Add/Remove Programs, please run "msiexec /x {71F8EFBF-09AF-418D-91F1-52707CDFA274}" from a command line window

To download a tool that may help you clean your computer in preparation for installing Visual Studio 2005, please visit this link. Please Note: This tool is not supported or thoroughly tested by Microsoft. This is a free tool and you should use it at your own risk. No warranty or support is provided, expressed or implied.

If you have any problems after following these steps, or for more information about the uninstall process, please review the following page: Uninstalling Previous Versions of Visual Studio 2005.

1.3. Product Installation

1.3.1   Installation of Visual Studio 2005 on the Intel Itanium (IA64) is not supported. 

Visual Studio 2005 does not support the Intel Itanium (IA64) processor.

To resolve this issue

If you need to develop Itanium applications, install Visual Studio on another computer and use the cross compilers to target the Itanium platform.

1.3.2   SQL Express installation fails when pre-released SQL Express components are not uninstalled 

SQL Express component setup will fail if any of the following pre-released SQL Express components are left on the computer:
 

  1. "Microsoft SQL Server 2005 Express Edition"
  2. "Microsoft SQL Server 2005 Tools Express Edition"
  3. "Microsoft SQL Native Client"

In most cases, setup only displays a list of Beta components detected on the targeted computer. However, SQL Express components will always appear in this list if any other Beta components are detected. In other words, these SQL Express components could appear in the list even after the user uninstalls them.

To resolve this issue

Ensure the matching .NET Framework Beta is on the computer before performing the following steps:
1) Remove "Microsoft SQL Server 2005 Express Edition"
2) Remove "Microsoft SQL Server 2005 Tools Express Edition"
3) Remove "Microsoft SQL Native Client"
You may ignore the Beta warning message about these components if they were uninstalled previously.

1.3.3   Setup fails when installing from a mounted drive in a Virtual PC environment 

When installing Visual Studio 2005 on a Virtual PC, setup fails because it cannot access certain files.
This happens when the drive is mounted using the CD Drive mount software provided with Virtual PC or your Visual Studio 2005 media is a DVD because the mounting software can only support 2.2 Gigabytes of data.

To resolve this issue

You can use a third-party DVD Drive mounting software. Alternatively, you can copy the contents of the Visual Studio 2005 DVD to your computer's hard drive, share the folder with your Virtual PC, and then direct Visual Studio 2005 installation setup to the folder.

1.3.4   Upgrade from previous releases of Visual Studio 2005  

First of all, thank you for contributing to the release of Visual Studio 2005 by helping us to test our pre-release versions, such as Beta 1, Beta 2 or Community Tech Preview, and for installing this final-release version! However, final-release setup does not support uninstalling pre-release versions. For best results, it is recommended you install on a clean computer that has not had a pre-release version of Visual Studio 2005 previously installed on it. While it is not officially supported, we tried to ensure the scenario of uninstalling and reinstalling from Visual Studio 2005 Beta 2 to the released version has as few issues as possible. To uninstall Visual Studio 2005 Beta 2, you must uninstall in the order specified in section 1.2 of this readme file or use the uninstall tool. Most Beta 2 projects can be carried forward to the final release version. For details on any changes needed for forward compatibility, see this link.

To resolve this issue

If you have Visual Studio 2005 Beta installed and want to install the released version, you must uninstall in the order specified in section 1.2 of this readme or use the uninstall tool.

1.3.5   Installing Visual Studio 2005 using the runas command fails. 

Unless you are logged in as an administrator, using the runas command to install Visual Studio 2005 is not supported and will fail. Running Visual Studio 2005 after it is installed is supported for non-administrators.

To resolve this issue

Log in as an administrator to install Visual Studio 2005.

1.3.6   Installing Visual Studio 2005 from CD fails. A network installation is requested. 

The media that Visual Studio 2005 shipped on may be bad, preventing a successful installation.

To resolve this issue

Visual Studio 2005 setup may be run from a network share as an alternative to running setup from CDs or DVDs. The following procedure illustrates how to prepare Visual Studio 2005 for installation from a network share. The procedure refers to the Visual Studio 2005 CDs, but the steps are the same for DVDs.

1) Create a folder (for example, VS2005) on the server.
2) Create two subfolders, named VS, and MSDN within the top-level folder. For example:
    VS2005\VS
    VS2005\MSDN.

3) Copy the contents of the Visual Studio 2005 CDs into the VS2005\VS folder. Select Yes if prompted to overwrite any existing files.
4) Copy the contents from all the CDs labeledMSDN Library for Visual Studio 2005 to the subfolder named MSDN. Select Yes if prompted to overwrite any existing files.
5) OpenSetup.iniin the VS subfolder using a text editor, such as Notepad.
6) In the [Documentation] section, change the line that starts with "DIR=" as follows:
    [Documentation]
    DIR=..\MSDN

7) Save your changes and close the file.
NoteCompleting this step prevents disk-swapping requests during setup and informs the setup program of the correct path to the MSDN Library CDs.

8) In the VS subfolder, open the Setup folder.
9) Open setup.sdb in a text editor, such as Notepad, and add the following lines to the end of the file:
    [Product Key]
    XXXXXXXXXXXXXXXXXXXXXXXXX
NoteXXXXXXXXXXXXXXXXXXXXXXXXX is the 25 digit product key, entered without dashes, found on the CD packaging.

10) Save your changes and close the file.
NoteCompleting this step enables pre-populating the product key for the user who will install from the network share.

11) Share the VS2005 folder on the network and set the appropriate security settings. The path to Visual Studio 2005 setup from the network looks like \\[servername]\VS2005\VS\setup.exe

NoteSetup will fail if any path and file name combination exceeds 260 characters. The maximum length of a path in Visual Studio is 221 characters. You should copy files to a path with less than 70 characters. If you create a network share for a network image, the UNC path to the root installation location should contain fewer than 39 characters.

NoteSetup might fail if the folder names in this path include embedded spaces, for example:
\\[servername]\VS2005\MSDN\
\\[servername]\VS2005\Visual Studio\

1.3.7   Installing any edition of Visual Studio 2005 from an installation path that is longer 100 characters fails on Windows 2000. 

When setup is launched from a path that is longer than 100 characters, setup fails due to a maximum path limitation in Windows 2000. Path length is not an issue on Windows XP or Windows 2003 Server.

To resolve this issue

When installing from a network, map the network path to a local drive and install from that drive. For example, if the path is \\computername\programs\test folder\development tools\external\Microsoft\Visual Studio 2005\beta release, you can map it to a network drive by doing the following:

1) From theStartmenu, chooseRun.
2) Typecmdand then clickOK.
3) At the command prompt, type the following:
   net use * “\\computername\programs\test folder\development tools\external\Microsoft\Visual Studio 2005\beta release”

Windows maps the network drive for you. The drive letter is displayed in the console window.

When installing from a local folder, copy the contents of Visual Studio to another folder on the computer that has a total path length of less than 100 characters.

Note:If you install Visual Studio from a CD or DVD, you will not encounter any path length issues.

1.3.8   Warning dialog appears when uninstalling MSXML 6.0. 

To completely uninstall Visual Studio, you must manually uninstall MSXML 6.0 using Add or Remove Programs. During uninstall for MSXML 6.0, the following warning may appear:

Warning 26002. The following product(s) is dependent on MSXML 6.0. If you uninstall MSXML 6.0, they will be broken. Please uninstall those product(s) first. Do you want to go ahead to uninstall MSXML 6.0 anyway?

Microsoft SQL Server 2005 Express Edition Beta 2 (SQLEXPRESS)
Microsoft SQL Server 2005 Tools Express Edition Beta 2

To resolve this issue

You must manually uninstall all of the products listed in the warning before you uninstall MSXML 6.0.

Any SQL Server products that need to be uninstalled are listed on the final page displayed after Visual Studio is uninstalled. If products other than SQL Server are listed in the warning text, those products also will need to be uninstalled before you uninstall MSXML 6.0.

1.3.9   Installation path cannot accept non-ANSI characters on Japanese MUI OS. 

On JPN MUI OS, when installing Visual Studio Team Suite to path with non-ANSI characters such as “c:\program files\噂 浬 詰 圭 構 蚕 十 觸 Microsoft Visual Studio 8”, a dialog box pops up saying “can't accept non-ANSI characters”.

This problem occurs on all JPN MUI OS (including Windows 2000, Windows 2003 and Windows XP series operating systems). It does not occur on JPN OS.

To resolve this issue

Use ANSI characters for the destination path.

1.3.10   Internet Explorer Script Error! An error has occurred in the script on this page. 

This error, and "Could not complete the operation due to error 887600de", might be encountered while installing Visual Studio Standard on Windows 2000 with Service Pack 4. This error occurs on computers with low color depth. This error occurs on machines with low color depth.

To resolve this issue

Enable more colors:

1. Cancel Visual Studio install.
2. Right click on the desktop wallpaper.
3. Click on Properties.
4. Click the Settings tab.
5. Adjust the Color Quality to a higher setting.
6. Click OK
7. Install Visual Studio again.

1.3.11   Load Test Agent installs only if controller is running. 

Installation of Team Load Test Agent will fail if the specified controller is not running. To verify this problem, examine AgentConfigUtil.exe.log in \Program Files\Microsoft Visual Studio 8\Microsoft Visual Studio Team Suite\LoadTest directory.

To resolve this issue

Ensure that the controller is installed and the service is running, and then try the installation again.

1.3.12   Installing Microsoft Office 2003 Primary Interop Assemblies 

You want to install the Microsoft Office 2003 Primary Interop Assemblies after you have finished installing Visual Studio 2005, but you do not know how to install them.

To resolve this issue

1. On the installation media, navigate to the \setup folder.
2. Open PIAInstall.htm and follow the instructions listed.

1.3.13   Antivirus applications that are configured to clean the Temp folder might cause setup to fail  

If setup needs to reboot and your antivirus application is set to clean the Temp folder on launch, necessary setup files will be deleted and setup will fail due to a program-not-found error.

To resolve this issue

Before running Visual Studio setup, reset the antivirus application to leave Temp folder contents intact on launch or reboot. Reference your Antivirus help documentation for steps on how to do this.

1.3.14   Setup does not check disk space when auto-launching after selecting "reboot later". 

Whenreboot lateris selected and the available space on the hard drive is filled beyond the amount of space needed by setup, an out-of-space error will occur after reboot.

To resolve this issue

Ensure that enough disk space will be available by rebooting before installing or opening other applications. The required disk space is displayed when you select the location to install the product.

1.3.15   Removing the .NET Framework breaks SQL Server 2005 and MSDN Express Library. 

You must uninstall SQL Server 2005 and MSDN Library before uninstalling .NET Framework 2.0 or you will encounter an error. You can install newer versions of SQL Server 2005 or MSDN Library only after removing all previous SQL Server 2005 components and MSDN library components, as listed below.

To resolve this issue

1. From theControl Panel, selectAdd or Remove Programs.
2. Select SQL Server 2005 components and clickRemoveto remove each component below.
 

  • Remove "Microsoft SQL Server 2005 Express Edition"
     
  • Remove "Microsoft SQL Server 2005 Tools Express Edition"
     
  • Remove "Microsoft SQL server setup support files"
     
  • Remove "Microsoft XML 6.0"
     
  • Remove "Microsoft SQLXML 4.0"
     
  • Remove "Microsoft SQL Native Client"
     
  • Remove "Microsoft MSDN library"


3. Select the .NET Framework 2.0 and clickRemove.
4. Install SQL Server 2005.
Note: If you remove the Beta .NET Framework 2.0 before removing all SQL Server 2005 components or MSDN Library, you must reinstall .NET Framework 2.0 before you can successfully perform the steps above.

1.3.16   After being uninstalled, SQL Server Express requires a reboot before it can successfully reinstall.  

When all SQL Server Express components are uninstalled, and then SQL Server Express is reinstalled via Maintenance Mode (for VSTS, you will need to install MSXML 6.0 first), the reinstallation fails. No cause is written to the VS logs.

To resolve this issue

After uninstalling SQL Server Express, reboot the computer before reinstalling it.

1.3.17   Customers who wish to use Visual Studio 2005 Tools for Microsoft Office projects need to install Office and SP1 before installing Visual Studio Team System 

The issue is that VSTO 2.0 features require an updated OtkLoader instead of the version that came with Office 2003.

When VSTS is installed, the VSTO runtime (which includes the updated OtkLoader) is installed. If Office is present at installation time, OtkLoader is updated and everything will function as expected. However, if Office is not present, OtkLoader cannot be updated. Users must then install Office SP1 and run VSTOR.EXE to update OtkLoader manually.

To resolve this issue

Run VSTOR.EXE to update the version of OtkLoader.

1.3.18   C++ Itanium Native Tools Setup Requirement for MFC and .NET Windows Forms Integrations 

In order to develop applications that combine MFC and .NET Windows Forms you will need to follow an additional step.

To resolve this issue

Manually install mfcmifc80.dll to the Global Assembly Cache using the gacutil.exe.

1.3.19   C++ Tools for Itanium Setup Location for Itanium Redistributables 

The redistributable files for Itanium are installed to the incorrect location during the Visual Studio Tools for 64-bit Setup (available only in Visual Studio Team System products).

To resolve this issue

You can find the Itanium redistributables in the Microsoft Visual Studio 2005\VC\Redist\x86 folder.

2. Microsoft .NET Framework 2.1. Product Installation

2.1.1   ngen.exe might fail with REGDB_E_CLASSNOTREG or RPC_S_SERVER_UNAVAILABLE. 

ngen.exe occasionally fails with REGDB_E_CLASSNOTREG or RPC_S_SERVER_UNAVAILABLE.
The failure usually happens if you issue consecutive ngen commands back to back. Retry or reboot might help as long as you wait 15 minutes or so between two ngen commands. However, reboot does not fix the general problem and you might encounter it again

To resolve this issue

Install DCOM 98 patch from here: DCOM98Patch

2.1.2   Installing SDK hangs at "setup is configuring the install…”. 

Installation hangs for about an hour or more at "setup is configuring the install…” and then gives the error message "invalid directory…"

This problem is caused by a lack of available disk space.

To resolve this issue

Free up sufficient space on the disk drive.

2.1.3   x64 .NET Framework Language Pack 2.0 ProductVersion says 1.1.##### instead of 2.0.##### 

When deployed thru Active Directory, the language pack version number is displayed in the Group Policy Object - Software installation table. This can be confusing when the product name states "2.0" but the version data says "1.1"

To resolve this issue

There is no known resolution.

2.1.4   Installing Windows Server 2003, followed by the .NET Framework 2.0, and then upgrading to Windows Server 2003 SP1 using a full CD, breaks .NET Framework 2.0 applications. 

Upgrading using a CD with the full Windows Server 2003 SP1 installation replaces the shared file mscoree.dll on the user's computer with the .NET Framework 1.1 mscoree.dll file.
As a result, applications compiled against the .NET Framework 2.0 will fail to run after the Service Pack is installed.
Note, this does not happen when Windows Server 2003 is updated with just the Service Pack.

To resolve this issue

After installing the Windows Server 2003 Service Pack, the .NET Framework needs to be repaired.
1. From theControl Panel, selectAdd or Remove Programs.
2. Select Microsoft .Net Framework 2.0.
3. ClickChange/Remove.
4. When the dialog appears, selectRepairand clickNext.
5. If prompted to do so, reboot the computer.

2.1.5   Installing on 64-bit OS when IIS 6 is in WoW64 mode will disable ASP.NET 1.1 in IIS. 

Existing ASP.NET 1.1 applications will be disabled when the 64-bit .NET Framework 2.0 Beta 2 is installed on a 64-bit operating system that has IIS6 in WoW64 mode and ASP.NET 1.1 enabled. This happens because the Framework setup incorrectly maps the aspnet_filter to the 64-bit version and removes version 1.1 of the aspnet_isapi extension.

To resolve this issue

You must manually change IIS to use the 32-bit version of the aspnet_filter and reinstall the ASP.NET 1.1 ISAPI extension.


1.    Start Internet Information Services Manager (inetmgr.exe).
2.    Expand the local computer node, then click the Web Sites node.
3.    From theActionmenu, selectProperties.
4.    In theWeb Site Propertiesdialog box, select theISAPI Filters tab.
5.    In the list of filters, select the ASP.NET 2.0 filter and click Remove.
6.    ClickAddand then enter the following:
        Filter Name: ASP.NET_ 1.1.4322
        Executable: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_filter.dll
7.    ClickOK.
8.    Under the Local Computer node, click theWeb Service Extensions node.
9.    UnderTasks, clickAdd a new Web Service Extension.
10.    In theNew Web Service Extensiondialog box, enter the following:
        Extension Name: ASP.NET v1.1.4322
        For Required files, clickAdd... and then enter: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll
        CheckSet Extensionstatus to Allowed.

        ClickOK.
 

2.1.6   x64 netfx SDK JPN has ProductVersion = 1.1.##### instead of 2.0.##### 

When deployed thru Active Directory, the version number is displayed in the Group Policy Object - Software installation table. This can be confusing when the product name states "2.0" but the version data says "1.1".

To resolve this issue

There is no known resolution.

3. Smart Device Programmability 3.1. Product Installation

3.1.1   Installing PB after Visual Studio will duplicate smart device platforms. 

Currently, installing PB after Visual Studio 2005 will duplicate platform entries in datastore. When Visual Studio is invoked later or restarted, duplicate platform entries will be eliminated based on Platform ID without respect to how the entry was added. As a result, changes made to datastore (e.g., emulator settings) before PB was installed might be lost as part of duplicate entry removal.

To resolve this issue

Change the settings of the affected platforms manually through Visual Studio.

3.1.2   Installing and uninstalling PB on a computer with Visual Studio 2005 affects Visual Studio 

Uninstalling PB unregisters conman2.dll and some other dlls on which Visual Studio depends. As a result, Visual Studio smart device functionality might be impaired.

To resolve this issue

Repair-installing Visual Studio fixes the problem.

Question 1: Choosing between project types

What is the difference between a 'Win32 Project' and a 'Managed C++ Empty Project'? The difference is not explained in the Help topic for these project types.

Answer: A "Win32 Project" is unmanaged (native) C++, while a "Managed C++ Empty Project" is an empty project for Managed C++. So the difference is managed versus unmanaged.

Question 2: Documentation has no back button

It is extremely inconvenient not to have a Back button. Every time I go down the wrong path and don't find what I'm looking for (for example, Managed C++ Empty Project), I have to go back to the beginning and start all over again. What do I use instead?

Answer: When you are navigating through the documentation, you can use the various buttons on the Web toolbar. To display the Web toolbar, click View, and then Toolbars, and then click Web if it doesn't already have a check next to it. This toolbar contains forward and back arrows, up and down arrows (for previous topic and next topic), and other helpful buttons. Similarly, when you are moving from one source file to the next, you can move back to previously viewed files (and forward, if applicable) by using the Navigate Backward and Navigate Forward buttons on the Standard toolbar. To display the Standard toolbar, click View, Toolbars, and then make sure Standard is checked.

Question 3: Why can't I add a façade layer?

I cannot add a facade-layer project between the Web Services layer of my project and the business-logic layer. Why can't I do this?

Answer: The policy expressed in the DAP.tdl policy file by default restricts facade-layer projects from being added between the Web Services layer and the business-logic layer. You can remove this restriction from a project by changing one line in the policy file (which is based on DAP.tdl) that the project is using. To see how, read Modifying the Façade Layer Constraint in the Visual Studio documentation.

Question 4: Adding a project item to a template

The Enterprise Template walkthroughs are good for building the same type of projects over and over. But what about a template for a Project Item such as a form? If the Enterprise Template has been customized to use a customized Web form, for instance, and we would like to add another Web form to the project that is based on the one in the Enterprise Template, how do we add that form to the project?

Answer: It should work for you to follow the steps in the "Creating a Project Item Prototype" section of the topic Walkthrough: Creating a New Enterprise Template Building Block (to find it quickly, input the address ms-help://MS.VSCC/MS.MSDNVS/vsent7/html/vxwlkWalkthroughCreatingNewEnterpriseTemplateBuildingBlock.htm in the URL text box in the Web toolbar). Keep in mind while doing this that your custom Web form is the same as a custom class, and this topic describes how to make a custom class project item available in the Enterprise Template.

You would also benefit from the whitepaper Using Custom Code Attributes for TDL Identification in Enterprise Templates at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vstchusingcustomcodeattributesfortdlidentificationinenterprisetemplates.asp. This describes how you can identify your new class through the use of custom code attributes, after which you can control (allow or constrain) the class through your project's policy file. In the policy file, you would define an Element and a Project Item, and then edit the policy file so that it allows adding project items (your Web form) to the parent project type. For an example, look in the topic Walkthrough: Creating a New Enterprise Template Building Block in the section "Defining an ELEMENT in a Policy File."

Question 5: Changing templates after distribution

The result of using Enterprise Templates is cool, but let's say I change something in my template (while using it, I'm also adapting it to the best production of my team). I then have to get inside all of the template files to make changes and then redistribute it. How best to do this?

Answer: It depends. The question of how to edit these different parts and make the new versions available -- after work has begun on an application based on the template -- has a different answer depending on the part. Here is information on all three:

  • Help. You can change Help files easily after a project has begun. Development team members see the new Help pages the first time they access Help after you have made your changes. The documentation describes the relevant steps in the section Providing Custom Help for Enterprise Templates; this topic has the address ms-help://MS.VSCC/MS.MSDNVS/vsent7/html/vxgrfProvidingCustomHelpForEnterpriseTemplateApplications.htm.
  • Policy. You can also change policy after a project has been begun. If you plan to change policy, it is best to have all the projects in your template point to a single policy file on a shared network location. (See the topic Providing Policy From a Shared Network Location; this topic has the address ms-help://MS.VSCC/MS.MSDNVS/vsent7/html/vxtskprovidingpolicyfromsharednetworklocation.htm.) This way, after you update a policy file, all the projects that point to it will simply point to the new version of it, as long as the Policy File property in each project still references that policy file correctly.
  • Project Structure. Templates were not intended to propagate changes made to their structure after projects have been instantiated from that template. Instead, you should apply standard source-control mechanisms for modifying the instantiated project. This means that you would need to make changes both to the template and to any projects that have already been generated from that template.

Question 6: Enterprise Template documentation in languages other than English

I am using Enterprise Templates now, but as I am a native German speaker, I'd prefer to read the Help topics for Enterprise Templates in German. Where can I find it?

Answer: If you bought an English-language copy of Visual Studio .NET, your documentation is entirely in English and there is no way to order the documentation (in German) separately. MSDN publishes large sections of Microsoft documentation in a number of languages online, including German, but no German-language documentation of Visual Studio .NET is currently available online. The only way to obtain it is to purchase a German-language copy of Visual Studio .NET.

Question 7: Can I use Policy in various Visual Studio .NET SKUs?

According to the Enterprise Template documentation, I need either Visual Studio .NET Enterprise Developer or Visual Studio .NET Enterprise Architect to use Enterprise Templates. Is that for building them only? Or can I distribute the created template to developers after it has been created using Architect or Developer editions, and then have them develop using that template with Visual Studio. NET Pro?

Answer: The dividing line is not whether a project is based on an Enterprise Template, but whether the project has policy. You cannot open any project that has associated policy in Visual Studio .NET Pro; you can only open them in Enterprise Developer and Enterprise Architect.

Question 8: Does the custom wizard project have C++ requirements?

I want to create and use a custom wizard with my Enterprise Template, but I don't want to use C++ to do it. The only folder in the New Project dialog box that has a custom wizard is the "Visual C++ Projects" folder. There are no custom wizards in the C# or Visual Basic folders. Where do I go for C# and Visual Basic custom wizards?

Answer: While the custom wizard icon appears in the C++ folder in the New Project dialog box, there is no direct requirement or linking of it to the C++ language. Because it is not language dependent, you can use it for C# or Visual Basic projects, as well as C++ projects.

How Do I Change the Default Icon Used By Add-in Toolbar Commands and Buttons?

When you create an add-in using the Visual Studio .NET Add-in project type (which you can access by clicking Other Projects, then Extensibility Projects in the New Project dialog box), you have the option of creating a UI for the add-in by checking the "Would you like to create a UI for the user to interact with your Add-in" box. When you do this, the template creates a Tools menu item that causes your add-in to load when a user clicks it. The menu item uses a default smiley-face icon (☺) next to the command, which you might want to change by using one of two methods. You can simply change the default icon index number (59) to the number of another standard icon from the Microsoft Office Object Library (MSO.DLL), which contains nearly 3,000 icons and is included in Visual Studio .NET. Your other option is to define a custom bitmap, such as a company logo or custom icon, in a satellite DLL and then change your code to point to that new bitmap. The former method is quicker and easier, but you have fewer icons to choose from. The latter method involves a bit more work, but you get to use the exact icon you want. Both methods are outlined below.

To change the default icon to another standard icon

  1. Load the solution created by the Add-in Wizard.
  2. In the OnConnection event, look for the following line:
    ' Visual Basic .NET
    CommandObj = applicationObject.Commands.AddNamedCommand(objAddIn, _
    "MyAddin", "MyAddin", "Executes the command for MyAddin", True, 59, _
    Nothing, 1 + 2)
    
    // Visual C# .NET
    Command command = commands.AddNamedCommand(addInInstance, "MyAddin1", 
    "MyAddin1", "Executes the command for MyAddin1", true, 59, ref contextGUIDS, 
    (int)vsCommandStatus.vsCommandStatusSupported+(int)vsCommandStatus.vsCommandStatusEnabled);
  3. Notice the number 59 in the AddNamedCommand line. This is the index to the default icon (a smiley-face). Change this to the number of the desired icon. For example, if you wanted to change it to a red star, you would change 59 to 6743.
  4. Reset the command bar information by typing devenv /setup at the Visual Studio .NET Command Prompt. This ensures that your new icon will display on the toolbar.
    Caution   Doing this will delete all customizations you have made to Visual Studio .NET command bars. The command bars are rebuilt according to the loaded add-ins and packages.

When you run your add-in, the command appears on the Tools menu next to a red star icon.

To obtain a complete list of the MSO icons, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno97ta/html/faceid.asp. This article in the MSDN library contains a small application that lets you view all of the icons and obtain their ID numbers so you can choose the icon you want.

If you cannot find an appropriate icon in the MSO library, you must use a custom bitmap for the add-in's command icon. The following procedure demonstrates how to do this. The basic procedure is to create a Class Library that contains a resource file that in turn contains the custom icon you want to use. You then point AddNamedCommand to the custom icon. (Note that the following procedure assumes that your project creates the command on the Tools menu.) The procedure is similar for both Visual Basic .NET and Visual C# .NET.

Note   The MSDN Automation Samples site has a downloadable example project demonstrating how to do this in Visual Basic .NET and Visual C# .NET. Go to http://msdn.microsoft.com/vstudio/downloads/samples/automation.aspx and click the "Custom Bitmap Add-in" link.

To change the default icon to a custom bitmap

  1. Load your add-in solution.
  2. Add a new Class Library project to the solution. For purposes of this example, call it ClassLibrary1.

    This will house the resource file that contains your custom icon. (Note: Do not confuse this with a class module. A Class Library is a type of project.)

  3. Add the desired image file to Class Library project. To do this, select the Class Library node in Solution Explorer, and then on the Project menu, click Add Existing Item and browse to the image file.
  4. Build the Class Library project by clicking Build ClassLibrary1 on the Build menu.
  5. Open the resultant Class Library .dll file in Visual Studio .NET.
  6. Add a Bitmap resource to this DLL. To do this, click the Icon node and then click Add Resource on the Edit menu.
  7. Select Bitmap in the list of resource types, click the Import button, and then save the DLL. Note the ID number assigned to the image in the DLL — you will need it later in step 11. If there are no other bitmaps in the DLL, the value is usually "101."
  8. Click the setup project and select Registry on the Editor submenu on the View menu. Locate the HKEY_CURRENT_USER/Software/Microsoft/VisualStudio/7.1/AddIns/<add-in name> node and add two new keys with the following string values (without quotes):
    SatelliteDllPath  "[TARGETDIR]"
    SatelliteDllName  "classlibrary.dll"
  9. Click the setup project and select File System on the Editor submenu on the View menu to display the project's file system. In File System, click the Application Folder node (in the left pane) and select Folder on the Add submenu on the Action menu. Name the new folder "1033." (This is the English locale ID — use the appropriate locale ID for your language.)
  10. Click the new folder, select Assembly on the Add submenu on the Action menu, and then add the Class Library DLL you created in step 4. You will need to click the Browse button in the Component Selector dialog box to navigate to the DLL.
  11. If you are using Visual Basic .NET, modify the connect.vb module (connect.cs for Visual C# .NET) to point to the new bitmap. In the AddNamedCommand statement in the OnConnection method, change the fourth argument (MSOButton) default value from True to False and set the bitmap ID parameter to the numeric ID value created in step 7.
  12. Build the addin and addinSetup projects.
  13. Install the add-in by running its setup.
  14. At the Visual Studio .NET Command Prompt, type devenv /setup.

    This forces Visual Studio .NET to reinitialize the toolbar buttons, allowing it to recognize your new custom bitmap.

  15. Start a new instance of Visual Studio .NET.

    You now see your new custom icon next to the add-in's command on the Tools menu.

How Do I Reference and Handle Programming Language-Specific Project Objects, Collections, and Events?

There are two answers to the question of referencing and handling project objects, collections, and events. The first answer deals with how to reference project-specific objects and collections, while the second answer deals with how to respond to project-specific events.

Referencing Language-Specific Project Objects and Collections

Visual Studio .NET provides a default, generic project object model — represented in the EnvDTE assembly primarily by the Project object and Projects collection — that allows you to programmatically query and control projects and project items in the IDE. This works well enough for most applications, but in some cases, you might need a finer degree of control, or to be able to access language-specific properties and methods. To give you such access, Visual Studio .NET supplies additional assemblies that support this. The VSLangProj assembly (namespace) also provides the VSProject object and VSProjectItems collection which give you access to the Visual Basic .NET and Visual C# .NET project structure, as well as additional related objects, collections, and constants. The Visual C++ .NET-specific VCProject and VCProjectItem objects and other supporting items are located in an assembly named VCProjectEngine. (Its full namespace is Microsoft.VisualStudio.VBProjectEngine.)

Because the language-specific project objects are late-bound, they do not automatically appear in the IntelliSense menus while you are programming against them. So if you want IntelliSense to fill in values as you type your code, you should reference the appropriate assembly before coding. The following is a list of the language-specific project objects and collections:

  • Basic
  • CSharpProjects
  • Deployment
  • DataService
  • Debugger
  • Help
  • TextEditor
  • VBProjects
  • VCLanguageManager
  • VCProjects

You can also view them using the Extensibility Browser. The Extensibility Browser (ExtBrws.dll) can be downloaded at http://msdn.microsoft.com/vstudio/downloads/samples/automation.aspx under "Unsupported Tools." After activating it in the Add-in Manager, it creates a command named "Extensibility Browser" on the Tools menu. When clicked, the Extensibility Browser displays all of the late-bound objects available under DTE and DTE.Properties, as well as the late-bound events under DTE.Events.

The following is a short macro example of how to use the late-bound VBProjects property — which returns a Projects object containing all of the Visual Basic projects in the solution — to list all of the Visual Basic .NET projects in the solution.

Sub ListVBProjs()
   ' VSMacro
   ' Lists all VB projects in the solution.
   Dim vbPrjs As Projects
   vbPrjs = CType(DTE.GetObject("VBProjects"), Projects)
   Dim Prj As Project
   For Each Prj In vbPrjs
      MsgBox(Prj.FullName)
   Next
End Sub

As I mentioned earlier, you can also use the generic Project/Projects to view and manipulate projects in your solution. The following example walks through the current solution and lists the type of each project.

' Visual Basic .NET
Imports EnvDTE
Imports VSLangProj

Module Module1
    Sub ProjTypesExample()
        Dim soln As Solution
        Dim Prj As Project
        Dim Prjs As Projects
        Dim DTE As EnvDTE.DTE

        ' Get an instance of the currently running Visual Studio .NET IDE.
        DTE = System.Runtime.InteropServices.Marshal. _
         GetActiveObject("VisualStudio.DTE")
        ' Set references to the solution and projects.
        soln = DTE.Solution
        Prjs = soln.Projects
        ' Walk through all of the projects in the solution
        ' and list the type of each project.
        For Each Prj In Prjs
            ' The PrjKind constants are in VSLangProj.
            If (Prj.Kind = PrjKind.prjKindVBProject) Then
                MsgBox(Prj.Kind & vbCr & Prj.Name & " is a VB project.")
            ElseIf (Prj.Kind = PrjKind.prjKindCSharpProject) Then
                MsgBox(Prj.Kind & vbCr & Prj.Name & " is a C# project")
            Else
                MsgBox(Prj.Name & " Is a C++ or other project type")
            End If
        Next
    End Sub
End Module 
// Visual C# .NET
using System;
using EnvDTE;
using VSLangProj;
using System.Windows.Forms;

namespace WindowsApplication8
{
   public class Module1
   {
      public static void ProjTypesExample()
      {
         Solution soln;
         Projects Prjs;
         EnvDTE.DTE DTE;

         // Get an instance of the currently running Visual Studio .NET 
         //IDE.
         DTE = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal.
         GetActiveObject("Visual Studio.DTE.7.1");         
         // Set references to the solution and projects.
         soln = DTE.Solution;
         Prjs = soln.Projects;
         // Walk through all of the projects in the solution
         // and list the type of each project.
         foreach (Project Prj in Prjs )
         {
            // The PrjKind constants are in VSLangProj.
            if (Prj.Kind==PrjKind.prjKindVBProject)
            {
               MessageBox.Show(Prj.Kind + Prj.Name+" is a VB project.");
            }
            else if((Prj.Kind==PrjKind.prjKindCSharpProject))
            {
               MessageBox.Show(Prj.Kind + Prj.Name+" is a C# project");
            }
            else
            {
               MessageBox.Show(Prj.Name + " Is a C++ or other project 
               type");
            }
         }
      }
   }
}

As you can see, you can perform generic iteration and query/manipulation operations using Project/Projects, but you cannot access project-specific properties such as, for example, the Visual Basic .NET properties AssemblyName, TemplatePath, Imports, and so forth. Using VSProject and VSProjectItem, though — or VCProjectEngine in the case of Visual C++ .NET — you can access these and other project-specific properties and methods. The following is an example of how to reference Visual Basic .NET-specific project properties.

To handle language-specific project properties

  1. Create a new Visual Basic .NET or Visual C# .NET add-in.
  2. To enable IntelliSense, reference the VSLangProj assembly by right-clicking the References node in Solution Explorer and adding the VSLangProj assembly from the .NET tab. Also, for Visual C# .NET, add a reference to System.Windows.Forms to allow message boxes to be used.
  3. At the top of the Connect.vb module (or Connect.cs for Visual C# .NET), add the following:
    ' Visual Basic .NET
    Imports VSLangProj
    
    // Visual C# .NET
    using VSLangProj;
    using System.Windows.Forms;
  4. At the top of the class, add the following:

 

  1.  
    ' Visual Basic .NET
    Dim soln As Solution
    Dim prj As Project
    Dim prjitem As ProjectItem
    Dim vsprj As VSLangProj.VSProject
    Dim vsprjitem As VSLangProj.VSProjectItem
    Dim i As Integer
    Dim msg As String
    
    // Visual C# .NET
    // Add the following to the bottom of the class.
    private Solution soln;
    private Project prj;
    private ProjectItem prjItem;
    private VSLangProj.VSProject vsPrj;
    private VSLangProj.VSProjectItem vsPrjItem;
    private int i;
    private string msg;
  2. To the OnConnection procedure, add the following:
  3.  
    ' Visual Basic .NET
    ' Create a solution reference.
    soln = applicationObject.Solution
    
    ' Create a new VB Windows Application project based on 
    ' the VB Windows Application project wizard template. The TRUE
    ' flag means that the project automatically creates a solution 
    ' for itself when created.
    soln.AddFromTemplate("C:\Program Files\Microsoft Visual Studio _
    .NET 2003\Vb7\VBProjects\WindowsApplication.vsz", "c:\temp", "A New _
    Project", True)
    
    ' Set generic references to the project and its first item.
    prj = soln.Projects.Item(1)
    prjitem = prj.ProjectItems.Item(1)
    
    ' Convert those generic "Object" return types to 
    ' VSProject/VSProjectItem types.
    vsprj = CType(prj.Object, VSLangProj.VSProject)
    vsprjitem = CType(prjitem.Object, VSLangProj.VSProjectItem)
    
    ' Access the following VSProject and VSProjectItem-specific properties:
    '  - TemplatePath()
    '  - ContainingProject()
    '  - Imports()
     MsgBox("Template path for '" & prj.Name & "' is: " & _
      vsprj.TemplatePath.ToString)
     MsgBox("'" & prjitem.Name & "' is contained in the '" & _
      vsprjitem.ContainingProject.Name & "' project.")
    
     For i = 1 To vsprj.Imports.Count
        msg = msg & vsprj.Imports.Item(i) & vbCr
     Next
     MsgBox("IMPORTS: " & vbCr & msg)
    
    // Visual C# .NET
    // Creates a solution reference.
    soln = applicationObject.Solution;
    
    // Creates a new C# Windows Application project based on 
    // the C# Windows Application project wizard template. The TRUE
    // flag means that the project automatically creates a solution 
    // for itself when created.
    soln.AddFromTemplate("C:\\Program Files\\Microsoft Visual Studio .NET 
    2003\\VC#\\CSharpProjects\\CSharpEXE.vsz", "c:\\temp", "A New 
    Project", true);
             
    // Set generic references to the project and its first item.
    prj = soln.Projects.Item(1);
    prjItem = prj.ProjectItems.Item(1);
    
    // Convert those generic "Object" return types to 
    // VSProject/VSProjectItem types.
    vsPrj = (VSLangProj.VSProject) prj.Object;
    vsPrjItem = (VSLangProj.VSProjectItem) prjItem.Object;
    
    // Access the following VSProject and VSProjectItem-specific 
    // properties:
    //  - TemplatePath()
    //  - ContainingProject()
    //  - Imports()
    MessageBox.Show("Template path for '"+prj.Name+"' is: 
    "+vsPrj.TemplatePath.ToString());
    MessageBox.Show("'"+prjItem.Name+"' is contained in the 
    '"+vsPrjItem.ContainingProject.Name+"' project.");
    
    for(i=1; i<=vsPrj.Imports.Count; i++)
    {
       msg = msg+vsPrj.Imports.Item(i)+"/n";
    }
    MessageBox.Show("IMPORTS: /n"+msg);
  4. Run the add-in.
  5. After a new instance of Visual Studio .NET starts, run the add-in by checking its box in the Add-in Manager.

At this point, you see message boxes displaying the values of the various properties.

For more information about accessing project-specific functionality, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconintroductiontovisualbasicprojectextensibility.asp and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconintroductiontovsprojectobject.asp.

Handling Language-Specific Project Events

Once you have set up references to language-specific project objects, you will then most likely want to handle their events. Doing this is basically a two-step process: first declare the event handler and then add the event handler itself to your code.

As I previously mentioned, the language-specific event objects are late-bound, and thus, not visible in the IDE unless you use the Extensibility Browser. Here is a list of the late-bound event objects (for DTE.Events):

  • CodeModelEvents
  • CSharpBuildManagerEvents
  • CSharpReferencesEvents
  • CSharpProjectItemsEvents
  • CSharpProjectsEvents
  • DebuggerEvents
  • VBBuildManagerEvents
  • VBImportsEvents
  • VBProjectItemsEvents
  • VBProjectsEvents
  • VBReferencesEvents
  • VCProjectEngineEventsObject

The following procedure demonstrates how to handle the three Visual Basic .NET project item events: ItemAdded, ItemRemoved, and ItemRenamed. It is followed by code that demonstrates how to do the same thing in Visual C# .NET.

To handle Visual Basic .NET- and Visual C# .NET-specific project events

  1. Create a new add-in project.
  2. At the top of the Connect class module, add the following:
    ' Visual Basic .NET
    Public WithEvents VBProjectItemsEvents As EnvDTE.ProjectItemsEvents

    This maps the generic project item events to the Visual Basic-specific project item events.

    For VSMacros, also put the following in the EnvironmentEvents module:

    <System.ContextStaticAttribute()> Public WithEvents VBProjectItemsEvents As EnvDTE.ProjectItemsEvents
  3. To ensure that events will stop being handled after the add-in is disconnected, in the OnDisconnection procedure of the Connect class module, add the following:
    VBProjectItemsEvents = Nothing
  4. In the OnConnection procedure of the Connect class module, add the following:
    VBProjectItemsEvents = _
     CType(applicationObject.Events.GetObject("VBProjectItemsEvents"), _
     EnvDTE.ProjectItemsEvents)

    This reference (VBProjectItemsEvents) becomes the source object for Visual Basic .NET project item events. It retrieves the appropriate event object from the automation model.

    Note that VSMacros do not need to do this step because they automatically connect the method handler as a result of the object variable declaration using the "WithEvents" handler.

  5. In a class module, add the procedures for the item-related events you want to handle. There should be three event handlers, one for the ItemAdded event, another for the ItemRemoved event, and the final one for the ItemRenamed event.
    Private Sub VBProjectItemsEvents_ItemAdded(ByVal ProjectItem As _
    EnvDTE.ProjectItem) Handles VBProjectItemsEvents.ItemAdded
       MsgBox("Item added")
    End Sub
    
    Private Sub VBProjectItemsEvents_ItemRemoved(ByVal ProjectItem As _
    EnvDTE.ProjectItem) Handles VBProjectItemsEvents. ItemRemoved
       MsgBox("Item removed")
    End Sub
    
    Private Sub VBProjectItemsEvents_ItemRenamed(ByVal ProjectItem As _
    EnvDTE.ProjectItem, ByVal OldName As String) Handles _
    VBProjectItemsEvents.ItemRenamed
       MsgBox("Item renamed")
    End Sub

When the add-in is run and you create a Visual Basic .NET project and add items to it or remove items from it, a message box displays alerting you to the event.

The following is a similar Visual C# .NET add-in example demonstrating how to handle the Visual C# .NET-specific project item events, ItemAdded, ItemRemoved, and ItemRenamed:

// Visual C# .NET
namespace CSharpEventHandler
{
   using System;
   using Microsoft.Office.Core;
   using Extensibility;
   using System.Runtime.InteropServices;
   using EnvDTE;
   using System.Windows.Forms;

   [GuidAttribute("9BBE7601-DBC7-48F7-8AC3-EB415380D205"), 
   ProgId("CSharpEventHandler.Connect")]
   public class Connect : Object, Extensibility.IDTExtensibility2
   {
      public Connect()
      {
      }

      public void OnConnection(object application, 
      Extensibility.ext_ConnectMode connectMode, object addInInst, ref 
      System.Array custom)
      {
         applicationObject = (_DTE)application;
         addInInstance = (AddIn)addInInst;
         
         MessageBox.Show("Connecting add-in");
         try
         {
            CSharpProjectItemsEvents = (EnvDTE.ProjectItemsEvents) 
            applicationObject.Events.GetObject
            ("CSharpProjectItemsEvents");
            CSharpProjectItemsEvents.ItemAdded += new 
            _dispProjectItemsEvents_ItemAddedEventHandler
            (CSharpProjectItemAdded);
            CSharpProjectItemsEvents.ItemRemoved += new 
            _dispProjectItemsEvents_ItemRemovedEventHandler
            (CSharpProjectItemRemoved);
            CSharpProjectItemsEvents.ItemRenamed += new 
            _dispProjectItemsEvents_ItemRenamedEventHandler
            (CSharpProjectItemRenamed);
         }
         catch(System.Exception)
         {
         }
      }

      public void OnDisconnection(Extensibility.ext_DisconnectMode 
      disconnectMode, ref System.Array custom)
      {
         MessageBox.Show("Disconnecting add-in");
         if(CSharpProjectItemsEvents != null)
         {
            CSharpProjectItemsEvents.ItemAdded -= new 
            _dispProjectItemsEvents_ItemAddedEventHandler
            (CSharpProjectItemAdded);
            CSharpProjectItemsEvents.ItemRemoved -= new  
            _dispProjectItemsEvents_ItemRemovedEventHandler
            (CSharpProjectItemRemoved);
            CSharpProjectItemsEvents.ItemRenamed -= new 
            _dispProjectItemsEvents_ItemRenamedEventHandler
            (CSharpProjectItemRenamed);
         }
      }

      public void OnAddInsUpdate(ref System.Array custom)
      {
      }

      public void OnStartupComplete(ref System.Array custom)
      {
      }

      public void OnBeginShutdown(ref System.Array custom)
      {
      }
      
      private void CSharpProjectItemAdded(EnvDTE.ProjectItem ProjectItem)
      {
         MessageBox.Show("Item added");
      }

      private void CSharpProjectItemRemoved(EnvDTE.ProjectItem 
      ProjectItem)
      {
         MessageBox.Show("Item removed");
      }

      private void CSharpProjectItemRenamed(EnvDTE.ProjectItem 
      ProjectItem, string OldName)
      {
         MessageBox.Show("Item renamed");
      }

      private _DTE applicationObject;
      private AddIn addInInstance;
      private EnvDTE.ProjectItemsEvents CSharpProjectItemsEvents;
   }
}

How Do I Create Custom Tool Windows?

Many of the windows in Visual Studio .NET, such as the Toolbox and Task List, are known as "tool windows." They are similar to other windows, but they can also be docked with other tool windows, pinned, and so forth. Visual Studio .NET allows you to create your own custom tool windows using the CreateToolWindow method. Because the Visual Basic .NET and Visual C# .NET automation model is built in COM, however, CreateToolWindow expects to be passed a COM object, not a .NET assembly. Therefore, you currently must implement a hosting, or "shim," control to site .NET user controls on Windows forms. (Visual C++ .NET tool-window applications, however, do not require the use of a shim control.)

The code for the shim control is available for download on the MSDN Automation Samples site. Before following the steps below, go to http://msdn.microsoft.com/vstudio/downloads/samples/automation.aspx, click the "Tool Window Add-ins" link, and then download the self-extracting .exe file, ToolWindow.exe. This creates four folders: \CPPToolWindow, \CSharpToolWindow, \VBToolWindow, and \VSUserControlHost. The first three folders contain fully working samples (Visual C++ .NET, Visual C# .NET, and Visual Basic .NET, respectively) that demonstrate how to implement a custom tool window. The fourth folder, \VSUserControlHost, contains the code for the shim control.

If you would rather just inspect the code and not type it all yourself, then you can just load one of the fully functioning tool window samples and inspect the code. If, however, you want to know more about how it works, the following procedure takes you step-by-step through creating your own custom tool window project. The basic procedure is to create the shim control, load your add-in, and then add a user control to host the UI for the new tool window.

Note   Building the shim control requires that the .NET Framework SDK be installed on your system. This is included with Visual Studio .NET 2003. If you chose not to install the .NET Framework SDK when you installed Visual Studio .NET (such as by choosing minimal install), then you are most likely missing a file required to build the shim control. The file is named mscoree.h and is located in $<VS Install Directory>$\SDK\v1.1\include. If you do not have this file or directory, you must run Visual Studio .NET setup and install the .NET Framework SDK before proceeding with the following procedure. Otherwise, you will get a compilation error when building the project.

To create a custom tool window

  1. Create the shim control:
    1. Load the project in the \VSUserControlHost directory. (It is a Visual C++ .NET project.)
    2. Before building the project, on the Tools menu, click the Options command. Navigate to the VC++ Directories page by clicking Projects in the left pane of the Options dialog box, and make sure to set the Include folder to the location of the file mscoree.h (usually under C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include, but the exact location depends on where you installed Visual Studio .NET) so that it can be found during the build.

      The .NET Framework SDK is not added by default to this dialog box because some users do not need to build components that host the .NET Framework; therefore, the .NET Framework SDK Include files are not added by default to the Platform SDK.

    3. Build the shim control project.
  2. Create a new add-in solution, or load an add-in solution in which you want to create the custom tool window.
  3. To enable IntelliSense, add a reference, named VSUserControlHostLib, to the VSUserControlHost shim control you created in step 1.
  4. Add a User Control to the add-in.

    This is the control that will be placed onto the tool window to contain the UI. (The control can be in a separate assembly, but the code below defaults to the add-in's assembly.)

  5. For Visual Basic .NET, add the following code to the Connect.vb module:
    Imports VSUserControlHostLib
    
    ' Objects required to create a tool window.
    Dim windowToolWindow As Window
    Dim objControl As VSUserControlHostLib.IVSUserControlHostCtl
    
    Public Sub OnDisconnection(ByVal RemoveMode As _
      Extensibility.ext_DisconnectMode, ByRef custom As System.Array) _
      Implements Extensibility.IDTExtensibility2.OnDisconnection
       ' Hide the tool window after disconnecting the add-in.
       If TypeOf windowToolWindow Is Window Then
          windowToolWindow.Visible = False
       End If
    End Sub
    
    Public Sub OnConnection(ByVal application As Object, ByVal _
      connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As _
      Object, ByRef custom As System.Array) Implements _
      Extensibility.IDTExtensibility2.OnConnection
    
       Dim objTemp As Object
       ' The following GUID must be unique for each different tool 
       ' window, but you may use the same guid for the same tool window.
       ' This GUID can be used for indexing the windows collection,
       ' for example: applicationObject.Windows.Item(guidstr)
       Dim guidstr As String = "{858C3FCD-8B39-4540-A592-F31C1520B174}"
    
       applicationObject = CType(application, DTE)
       addInInstance = CType(addInInst, AddIn)
       ' Create the tool window. Assign it the GUID specified in 
       ' guidstr. Its handle is windowToolWindow.
        windowToolWindow = _
         applicationObject.Windows.CreateToolWindow(addInInstance, _
         "VSUserControlHost.VSUserControlHostCtl", "Visual Basic .NET _
         Tool window", guidstr, objTemp)
    
       ' When using the hosting control, you must set visible to true 
       ' before calling HostUserControl. Otherwise the UserControl 
       ' cannot be hosted properly.
       windowToolWindow.Visible = True
       ' Link the user control to the tool window's Doc object 
       ' (objTemp).
       objControl = CType(objTemp, _
         VSUserControlHostLib.IVSUserControlHostCtl)
       ' Get the add-in's assembly and host the user control there.
       ' NOTE: Change "ControlClassHere" below to the name of your 
       ' control's class, such as "VBToolWinAddin.Control" or 
       ' "MyToolWin.UserControl1".
       Dim asm As System.Reflection.Assembly = _
         System.Reflection.Assembly.GetExecutingAssembly()
       objControl.HostUserControl(asm.Location, _
         "ControlClassHere")
    End Sub

    For Visual C# .NET, add the following line to the top of your add-in's Connect.cs class:

    using VSUserControlHostLib;

    and then add the following code to the OnConnection procedure:

    {
       object objTemp = null;
    
       // This GUID must be unique for each different tool window,
       // but you may use the same GUID for the same tool window.
       // This GUID can be used for indexing the windows collection,
       // for example: applicationObject.Windows.Item(guidstr)
       String guidstr = "{858C3FCD-8B39-4540-A592-F31C1520B174}";
             
       applicationObject = (_DTE)application;
       addInInstance = (AddIn)addInInst;
       windowToolWindow = applicationObject.Windows.CreateToolWindow 
       (addInInstance, "VSUserControlHost.VSUserControlHostCtl", "C# 
       Tool window", guidstr, ref objTemp);
             
       // When using the hosting control, you must set visible to true 
       // before calling HostUserControl. Otherwise the UserControl 
       // cannot be hosted properly.
       windowToolWindow.Visible = true;
       objControl = (VSUserControlHostLib.IVSUserControlHostCtl)objTemp;
       System.Reflection.Assembly asm = 
       System.Reflection.Assembly.GetExecutingAssembly();
       objControl.HostUserControl(asm.Location, 
       "ControlClassHere");
    }

    Add the following code to the OnDisconnection procedure:

    public void OnDisconnection(ext_DisconnectMode disconnectMode, ref 
    System.Array custom)
    {
       if(windowToolWindow != null)
       {
          windowToolWindow.Visible = false;
       }
    }

    At the bottom of the class, add the following:

    private Window windowToolWindow;
    private VSUserControlHostLib.IVSUserControlHostCtl objControl;
  6. In both examples, change the text ControlClassHere in the last line of code in the OnConnection procedure to the user control's ProgID.

    The ProgID is a combination of the name of your project and the name of your user control, separated by a period. For example, if your add-in is named "MyToolWin" and the User Control you added is named "UserControl1," the ProgID of the User Control would be MyToolWin.UserControl1.

  7. Add any desired controls and functionality to the user control.

After you build the project and activate the add-in in the Add-In Manager, the new tool window appears.

Note   Be sure that the line windowToolWindow.Visible = true is called before calling HostUserControl. Otherwise, the user control will be displayed in the upper left of your screen, parented to the desktop. You can hide the window after calling HostUserControl if you like.

So how does this work? The shim control acts as a "surface" for the new tool window to attach to. CreateToolWindow(), creates the visible, dockable tool window (based on the shim control), and finally, the User Control displays the UI for the tool window.

How Can I Add a Command for an Add-in to the Shortcut (Context/Right-Click) Menu, or the Submenu of Another Command?

Microsoft Office and Visual Studio .NET offer three kinds of CommandBar objects: toolbars, menu bars, and shortcut (also known as "context" or "popup") menus. Toolbars contain one or more menu bars. Menu bars are commands, such as File, Edit, and View. And finally, shortcut menus pop up on the screen, such as when you right-click a menu or object (such as a file or project). Submenus cascade off menu commands or off shortcut menus.

Shortcut menus are similar to other menus in Visual Studio .NET except that you access them by pointing to an arrow in a menu bar, or by right-clicking an item in the IDE rather than left-clicking. While the Visual Studio .NET Automation model makes it easy to place add-in commands on top-level menus, such as under the Tools menu, you can also add commands to shortcut menus and submenus. To do this, though, you must explicitly define the target shortcut menu and submenu by using the Microsoft Office Command Bar object model, and then call the Visual Studio .NET AddControl method.

To add a command to a shortcut menu (or any menu or toolbar), you must first know its command name. While you could do this by manually searching through the Keyboard node in the Options dialog box on the Tools menu, there is a handy sample add-in available that searches for a particular menu item, and then gives you its command name and other related information. This add-in sample is named "Command Browse Add-in" and it is located at http://msdn.microsoft.com/vstudio/downloads/samples/automation.aspx. (To access the add-in, unpack the project, build it, run the accompanying AddinReg.reg file, and then click the Command Browser command on the Tools menu.)

The following procedure demonstrates how to add an add-in command to a project's shortcut menu.

To add an add-in command to a shortcut menu

  1. Create an add-in project:
    1. In the New Project dialog box, click Other Projects, and then click Extensibility Projects. Name it "ContextMenuAddin."
    2. Select the option to create a UI for the add-in by selecting the "Create a tools menu item" option button.

      This adds some UI code to the OnConnection method. It also adds the Exec and QueryStatus methods, which will handle the event when someone clicks your add-in command and provide information on the status of your add-in, respectively.

  2. Replace the OnConnection method of the Connect class with the following:
    ' Visual Basic .NET
    Public Sub OnConnection(ByVal application As Object, ByVal _
    connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As _
    Object, ByRef custom As System.Array) Implements _
    Extensibility.IDTExtensibility2.OnConnection
       applicationObject = CType(application, EnvDTE.DTE)
       addInInstance = CType(addInInst, EnvDTE.AddIn)
       If connectMode = Extensibility.ext_ConnectMode.ext_cm_UISetup Then
          Dim objAddIn As AddIn = CType(addInInst, AddIn)
          Dim cmdObj As EnvDTE.Command
          Dim cmdBar As Microsoft.Office.Core.CommandBar
          Dim cmdBarCtl As Microsoft.Office.Core.CommandBarControl
          Dim cmdBarPopup As Microsoft.Office.Core.CommandBarPopup
    
          Try
             ' Create the add-in command.
             cmdObj = applicationObject.Commands.AddNamedCommand _
             (objAddIn, "ContextMenuAddin", "ContextMenuAddin", "Executes _
             the command for ContextMenuAddin", True, 6743, Nothing,  _
             1 + 2) '1+2 == vsCommandStatusSupported+vsCommandStatusEnabled
             ' Specify the menu (Project) and submenu (Add) where the add-
             ' in command should go.
             cmdBar = applicationObject.CommandBars.Item("Project")
             cmdBarCtl = cmdBar.Controls.Item("Add")
             ' The Add submenu is type "popup" (also known as context 
             ' menu).
             cmdBarPopup = cmdBarCtl
             cmdBar = cmdBarPopup.CommandBar
             ' Add the command to the pop-up menu.
             cmdObj.AddControl(cmdBar)
    
             Catch e As System.Exception
                MsgBox("Exception occurred: " & vbCr & e.ToString)
          End Try
       End If
    End Sub
    
    // Visual C# .NET
    public void OnConnection(object application, 
    Extensibility.ext_ConnectMode connectMode, object addInInst, ref 
    System.Array custom)
    {
       applicationObject = (_DTE)application;
       addInInstance = (AddIn)addInInst;
       AddIn objAddIn = (AddIn) addInInst;
       EnvDTE.Command cmdObj;
       Microsoft.Office.Core.CommandBar cmdBar;
       Microsoft.Office.Core.CommandBarControl cmdBarCtl;
       Microsoft.Office.Core.CommandBarPopup cmdBarPopup;
    
       object []contextGUIDS = new object[] { };
       Commands commands = applicationObject.Commands;
       _CommandBars commandBars = applicationObject.CommandBars;
    
       try
       {
          // Create the add-in command.
          cmdObj=applicationObject.Commands.AddNamedCommand(addInInstance, 
          "CSharpContextMenuAddin", "CSharpContextMenuAddin", "Executes the 
          command for CSharpContextMenuAddin", true, 6743, ref 
          contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported
          +(int)vsCommandStatus.vsCommandStatusEnabled);
          // Specify the menu (Project) and submenu (Add) where the
          // add-in command should go.
          cmdBar = applicationObject.CommandBars["Project"];
          cmdBarCtl = cmdBar.Controls["Add"];
          // The Add submenu is type "popup" (also known as context menu).
             
          cmdBarPopup=(Microsoft.Office.Core.CommandBarPopup)cmdBarCtl;
          cmdBar = cmdBarPopup.CommandBar;
          // Add the command to the pop-up menu.
          cmdObj.AddControl(cmdBar,1);               
       }
       catch(System.Exception e)
       {
          Console.WriteLine("Error encountered: "+e.Message);
       }
    }
  3. Add any code that you want to run when the command is clicked to the Exec procedure. You also must change the Exec and QueryStatus methods to reflect the new command name.
  4. Build the add-in. (There is no need to create a setup project unless you intend to distribute it to others.)
  5. Close the add-in solution.
  6. At the Visual Studio .NET Command Prompt, type devenv /setup.

    This resets all command bars so that the new menu command can display.

    Caution   Doing this will delete all customizations you have made to Visual Studio .NET command bars. The command bars are rebuilt according to the loaded add-ins and packages.
  7. Open or create a solution.
  8. Activate the ContextMenuAddin add-in by checking the box next to it in the Add-In Manager.
  9. Right-click the project node in Solution Explorer and then highlight the Add submenu.

    The ContextMenuAddin command now appears on the Add submenu.

Miscellaneous Tips and Issues

The following is a list of various tips to keep in mind when using Visual Studio .NET automation.

  • To unload a Solution add-in at runtime, use DTE.Addins.Item("MyAddin.Connect").Remove.
  • Visual Studio .NET automation currently does not feature auto-navigation to a code line by double-clicking an item added to the Task List, even if file name/line number are provided. Instead, you must connect to the event handler for the task that was double-clicked and then handle opening and moving to the line yourself.
  • Sometimes you need to use the Object property to access automation functionality, usually to get a reference to an automation object such as a tool window. For example, in Visual Basic .NET, to reference the Task List, you would use the following:
    Dim win As Window = DTE.Windows.Item(Constants.vsWindowKindTaskList).Object
  • The Visual Studio 6.0 and Visual Studio .NET automation models are almost entirely different, and thus, incompatible. Although the models are different, however, the functionality is similar, so most existing automation code can be rewritten fairly easily.
  • If your add-in's command bar is acting strangely — such as buttons disappearing, wrong icons appearing next to commands, and so forth — reset the toolbar by shutting down all instances of Visual Studio .NET and then issuing the command devenv /setup at the Visual Studio .NET Command Prompt. If that fails to fix the problem, try running the setup project for your add-in and choose the Repair option.
    Caution   Doing this will delete all customizations you have made to Visual Studio .NET command bars. The command bars are rebuilt according to the loaded add-ins and packages.
  • If old toolbar buttons for add-ins continue to persist on menus even after you unload the add-in in the Add-In Manager, either delete the registry key for the add-in or delete the add-in DLL itself (usually located in the /bin directory of the add-in project).
  • If you create an event handler that works for awhile but then suddenly stops working, then it is most likely because your event variable is scoped as local (function-level) rather than global (class-level). Since an event handler invocation prompts a garbage collection, the value is lost after exiting the event handler. For example, when responding to events using Visual C# .NET, you can add event handlers to many of the DTE events, such as:
    DTE.Events.get_DocumentEvents(null).DocumentOpened += . . . 
    DTE.Events.get_WindowEvents(docWindow).WindowActivated += . . .

    Unless you define the get_xxEvents variables outside the scope of these event handlers, though, they will stop responding after a short period of time (10-20 seconds) because both the events and the event handler are garbage-collected (as all temporary and local-level variables eventually are).