A new project contains build errors when you use a template that you exported from a project if the name of the old project contains space characters or other invalid identifying characters in Visual Studio 2005 (907754)



The information in this article applies to:

  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio 2005 Express Edition

SYMPTOMS

Consider the following scenario. In Microsoft Visual Studio 2005, the name of a Microsoft Visual Basic Windows Application project contains space characters or other invalid identifying characters. You export a template from the project. You create a new project by using the exported template. In this scenario, the new project contains the following build errors:
'Data_Project' is not a member of '<Default>'

Type 'Data_Project.My.MySettings' is not defined.

CAUSE

This problem occurs because certain code elements require the name to be embedded as a safe name. These code elements may include namespace issues. For example, when you name your project "Data Project," you notice the code Global.Data_Project in the Application.designer.vb file.

The Export Template Wizard cannot identify the safe name. The wizard uses the project name instead of the safe project name to search for the project name. Then, the wizard replaces the project name with the $safeprojectname$ template parameter. This behavior causes the safe project name not to be replaced. When you create a new application from the exported template, the safe project name that remains in the template causes the build errors to occur.

WORKAROUND

To work around this problem, make sure that any projects from which you export templates do not contain any space characters or invalid identifying characters in the project name.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

  1. In Visual Studio 2005, create a new Visual Basic Windows application, and then name the project Data Project.
  2. Add one DataSet control to Form1.vb.
  3. Click File, and then click Export Template.
  4. Select Project Template, and then click Next.
  5. Type Data Project in the Template Name box, and then click Finish.
  6. Close the Data Project solution.
  7. Click File, click New, and then click Project.
  8. Select Data Project under My Templates, and then click OK.

    When the new project loads, the project contains build errors.
For more information about the Export Template Wizard, visit the following Microsoft Developer Network Web site:

Modification Type:MajorLast Reviewed:2/9/2006
Keywords:kbtshoot kbBug kbProgramming kbprb KB907754 kbAudDeveloper