Microsoft KB Archive/834057

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

Article ID: 834057

Article Last Modified on 4/24/2007

-

APPLIES TO


 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Professional Edition
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Academic Edition
 * Microsoft Visual SourceSafe 4.0 Standard Edition
 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition
 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual C# .NET 2002 Standard Edition

-





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,  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.



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

The New Project dialog box appears. Under Project Types, click Visual Basic Projects. Under Templates, click Smart Device Application. In the Name box, type the name of the Smart Device Application project.</li> In the Location box, select a folder to save the Smart Device Application project to.</li> Click OK.

The Smart Device Application Wizard opens.</li> In the What platform do you want to target box, click Pocket PC.</li> In the What project type do you want to create box, click Windows Application.</li> Click OK.

By default, the Form1.vb file is added to the solution.</li> Add a Button control to the Form1 form.</li> Double-click the button that you added to the Form1 form.

The Code editor opens with the insertion point positioned in the event handler.</li>  In the Button1_Click event, add the following code: MsgBox(&quot;Hello World&quot;) </li> On the File menu, click Save.</li> On the File menu, click Exit.</li></ol> </li> Create a Windows Application project, and then add the smart device application to the project. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> Start Visual Studio .NET 2003.</li> On the File menu, point to New, and then click Project.

The New Project dialog box appears.</li> Under Project Types, click Visual Basic Projects.</li> Under Templates, click Windows Application.</li> <li>In the Name box, type the name of the solution for the Windows Application project.</li> <li>In the Location box, select a folder to save the Windows Application project to.</li> <li>Click OK.

By default, the Form1.vb file is added to the solution.</li> <li>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.</li> <li>In the Look in box, locate the sample smart device application that was created.</li> <li>Click the solution, and then click Open.

You receive the first error message that is mentioned in the &quot;Symptoms&quot; section.</li></ol> </li></ol>

<ol> <li>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. <ol style="list-style-type: lower-alpha;"> <li>Start Visual Studio .NET 2003.</li> <li>On the File menu, point to New, and then click Project.

The New Project dialog box appears.</li> <li>Under Project Types, click Visual Basic Projects.</li> <li>Under Templates, click Smart Device Application.</li> <li>In the Name box, type the name of the Smart Device Application project.</li> <li>In the Location box, select a folder to save the Smart Device Application project to.</li> <li>Click OK.

The Smart Device Application Wizard opens.</li> <li>In the What platform do you want to target box, click Pocket PC.</li> <li>In the What project type do you want to create box, click Windows Application.</li> <li>Click OK.

By default, the Form1.vb file is added to the solution.</li> <li>Add a Button control to the Form1 form.</li> <li>Double-click the button that you added to the Form1 form.

The Code editor opens with the insertion point positioned in the event handler.</li> <li> In the Button1_Click event, add the following code: MsgBox(&quot;Hello World&quot;) </li> <li>On the File menu, click Save.</li></ol> </li> <li>Add the smart device application to the source code control. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>On the File menu, point to Source Control, and then click Add Solution to Source Control.

The Visual SourceSafe Login dialog box appears.</li> <li>In the Username box, type the username. In the Password box, type the password, and then click Database.</li> <li>Click OK.

The Add to SourceSafe Project dialog box appears.</li> <li>In the Project box, type the project name.</li> <li>Click OK.</li> <li>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,  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.</li> <li>Click Yes.</li></ol> </li> <li>Create a Windows Application project, and then add the smart device application to the Windows Application project. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>Start Visual Studio .NET 2003.</li> <li>On the File menu, point to New, and then click Project.

The New Project dialog box appears.</li> <li>Under Project Types, click Visual Basic Projects.</li> <li>Under Templates, click Windows Application.</li> <li>In the Name box, type the name of the solution for the Windows Application project.</li> <li>In the Location box, select the folder to save the Windows Application project to.</li> <li>Click OK.

By default, the Form1.vb file is added to the solution.</li> <li>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.</li> <li>In the Look in box, locate the sample smart device application that was added to the source control.</li> <li>Click the solution, and then click Open.

You receive the second error message that is mentioned in the &quot;Symptoms&quot; section.</li></ol> </li></ol>

<div class="references_section">