You cannot add a smart device application to an existing solution in Visual Studio .NET (834057)



The information in this article applies to:

  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Professional Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition
  • Microsoft Visual SourceSafe for Windows 4.0
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)

SYMPTOMS

You cannot add a smart device application that you create to an existing solution. If the smart device application is not added to the source code control, and then you try to add the smart device application to an existing Windows Application project, you receive the following error message:

Project 'Smart Device Application Name' could not be opened because the Microsoft Visual Basic .NET compiler could not be created. All projects in a Visual Basic solution must target the same platform, but the project you are trying to add targets a platform other than the one specified by your solution.
Note In this error message, Smart Device Application Name is a placeholder for the name of the Smart Device Application solution.

When you try to add the Smart Device Application project from the source code control to an existing Windows Application project, you receive the following error message:

The operation could not be completed.

CAUSE

When you try to add the Smart Device Application project from the source code control to your Windows Application project, the Visual Basic .NET environment tries to open the Windows Application project that is added to the source code control. Visual Basic .NET cannot create an instance of a second compiler. Therefore, Visual Basic .NET sets the IErrorInfo interface, returns an HRESULT failure, and then quits the operation.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to reproduce the problem

Create a smart device application, and then add a smart device application to a Windows Application project when the smart device application is not added to the source code control

  1. Create a Smart Device Application project, and do not add this project to the source code control. To do this, follow these steps:
    1. Start Microsoft Visual Studio .NET 2003.
    2. On the File menu, point to New, and then click Project.

      The New Project dialog box appears.
    3. Under Project Types, click Visual Basic Projects.
    4. Under Templates, click Smart Device Application.
    5. In the Name box, type the name of the Smart Device Application project.
    6. In the Location box, select a folder to save the Smart Device Application project to.
    7. Click OK.

      The Smart Device Application Wizard opens.
    8. In the What platform do you want to target box, click Pocket PC.
    9. In the What project type do you want to create box, click Windows Application.
    10. Click OK.

      By default, the Form1.vb file is added to the solution.
    11. Add a Button control to the Form1 form.
    12. Double-click the button that you added to the Form1 form.

      The Code editor opens with the insertion point positioned in the event handler.
    13. In the Button1_Click event, add the following code:
      MsgBox("Hello World")
    14. On the File menu, click Save.
    15. On the File menu, click Exit.
  2. Create a Windows Application project, and then add the smart device application to the project. To do this, follow these steps:
    1. Start Visual Studio .NET 2003.
    2. On the File menu, point to New, and then click Project.

      The New Project dialog box appears.
    3. Under Project Types, click Visual Basic Projects.
    4. Under Templates, click Windows Application.
    5. In the Name box, type the name of the solution for the Windows Application project.
    6. In the Location box, select a folder to save the Windows Application project to.
    7. Click OK.

      By default, the Form1.vb file is added to the solution.
    8. In Solution Explorer, click the solution. Right-click the solution, point to Add, and then click Existing Project.

      The Add Existing Project dialog box appears.
    9. In the Look in box, locate the sample smart device application that was created.
    10. Click the solution, and then click Open.

      You receive the first error message that is mentioned in the "Symptoms" section.

Create a smart device application, and then add the smart device application to a Windows Application project when the smart device application is added to the source code control

  1. Create a Smart Device Application project and add this project to the source code control. To do this, follow these steps.

    Note Microsoft Visual SourceSafe must be installed on your computer.
    1. Start Visual Studio .NET 2003.
    2. On the File menu, point to New, and then click Project.

      The New Project dialog box appears.
    3. Under Project Types, click Visual Basic Projects.
    4. Under Templates, click Smart Device Application.
    5. In the Name box, type the name of the Smart Device Application project.
    6. In the Location box, select a folder to save the Smart Device Application project to.
    7. Click OK.

      The Smart Device Application Wizard opens.
    8. In the What platform do you want to target box, click Pocket PC.
    9. In the What project type do you want to create box, click Windows Application.
    10. Click OK.

      By default, the Form1.vb file is added to the solution.
    11. Add a Button control to the Form1 form.
    12. Double-click the button that you added to the Form1 form.

      The Code editor opens with the insertion point positioned in the event handler.
    13. In the Button1_Click event, add the following code:
      MsgBox("Hello World")
    14. On the File menu, click Save.
  2. Add the smart device application to the source code control. To do this, follow these steps:
    1. On the File menu, point to Source Control, and then click Add Solution to Source Control.

      The Visual SourceSafe Login dialog box appears.
    2. In the Username box, type the username. In the Password box, type the password, and then click Database.
    3. Click OK.

      The Add to SourceSafe Project dialog box appears.
    4. In the Project box, type the project name.
    5. Click OK.
    6. If this project is not created in Visual SourceSafe, you receive the following message:

      Project $Project Name does not exist, would you like to create it?

      Note In this message, Project Name is a placeholder for the name of the Smart Device Application project that you created.

      Note In this message, there is a comma after the word exist instead of a period. The letter w in the word would is incorrectly capitalized.
    7. Click Yes.
  3. Create a Windows Application project, and then add the smart device application to the Windows Application project. To do this, follow these steps:
    1. Start Visual Studio .NET 2003.
    2. On the File menu, point to New, and then click Project.

      The New Project dialog box appears.
    3. Under Project Types, click Visual Basic Projects.
    4. Under Templates, click Windows Application.
    5. In the Name box, type the name of the solution for the Windows Application project.
    6. In the Location box, select the folder to save the Windows Application project to.
    7. Click OK.

      By default, the Form1.vb file is added to the solution.
    8. In Solution Explorer, select the solution. Right-click the solution, point to Add, and then click Existing Project.

      The Add Existing Project dialog box appears.
    9. In the Look in box, locate the sample smart device application that was added to the source control.
    10. Click the solution, and then click Open.

      You receive the second error message that is mentioned in the "Symptoms" section.

REFERENCES

For additional information about creating Windows Forms applications for a device, visit the following Microsoft Developer Network (MSDN) Web site:For additional information about the IErrorInfo interface, visit the following MSDN Web site:For additional information about the Exception.HResult property, visit the following MSDN Web site:

Modification Type:MinorLast Reviewed:2/3/2006
Keywords:kbvs2005swept kbvs2005doesnotapply kbprb kbSrcControl kbWindowsForms KB834057 kbAudDeveloper