调试时遇到的问题:A project with an Output Type of Class Library cannot be started directly
| Visual Studio Tools for the Microsoft Office System: Errors |
Each project needs to contain the path to WinWord.exe or Excel.exe, so Visual Studio .NET can start the application when you debug. The path to Microsoft Office Word 2003 or Microsoft Office Excel 2003 in each project is determined by the location of Microsoft Office 2003 on the computer that created the project. If you open a solution that was created on another computer, and you have Office installed in a different location than the originating computer (for instance, if your drive letter is different, or you installed in a different folder), you can change the path by following these steps.
If your project uses a Word template, you must use the /z switch to raise the OnNew event when the new document is created. Do not include a space after /z, or Word will open the template for editing instead of creating a new document based on the template.
You must also set command-line arguments to point to the specific document, template, or workbook that is part of the project.
To point to the location of Office and the Office Document
- On the Project menu, click <ProjectName> Properties.
The <ProjectName> Property Pages dialog box opens.
- Select the Configuration Properties folder.
- Under Configuration Properties, select Debugging.
- In the Configuration list at the top of the dialog box, select All Configurations.
- In Visual Basic .NET projects:
- Set Start Action to Start External Program.
- Enter the path to Excel.exe or WinWord.exe, depending on which application you want to start.
- Under Start Options, set Command line arguments to point to the Office document associated with the project. For example:
"..\MyProject.xls"
Note If you are opening a Word template, use the /z switch with no following space:
/z"..\MyProject.dot"
In Visual C# projects:
- Under Start Action, set the Debug Mode property to Program.
- Click Apply.
//下面的部分可以不用设置了,DEBUG又可以使用了,这个问题主要是由于下载了VS.NET补丁造成
-
//的
-
- In the Start Application property, enter the path to Excel.exe or WinWord.exe, depending on which application you want to start.
- Under Start Options, set Command line arguments to point to the Office document associated with the project. For example:
"..\..\MyProject.xls"
Note If you are opening a Word template, use the /z switch with no following space:
/z"..\..\MyProject.dot"
- Click OK.
浙公网安备 33010602011771号