Outlook Projects

The project assembly and dependent assemblies that have their Copy Local property set to True. This property indicates that the assembly can be copied to the output directory.

(continues)

Table 2.3. Project Files Output During Build (Continued)

Word and Excel Projects

Outlook Projects

The application manifest, which is embedded in the document or workbook. An application manifest is an XML file that contains assembly location information.

The application manifest, which is an external XML file that contains assembly location information.

A program database file (PDB file), which stores information needed when you debug your application.

A program database file (PDB file), which stores information needed when you debug your application.

A copy of the project document or workbook.

To build a VSTO solution, click Build Solution on the Build menu. If you want to run the solution, either press F5 or click Start Debugging on the Debug menu. This action is similar to clicking Run Sub/User Form to run a VBA solution in the VBE. Because you chose Visual Basic environment settings, Visual Studio automatically determines whether to create a Debug or Release version of your application. For example, you should create a Release version before releasing your solution, but you should create a Debug version while you're coding.

When you select options in the Build menu, Visual Studio automatically creates a Release version; when you select Start from the Debug menu, Visual Studio creates a Debug version of the application. When you start debugging, Visual Studio builds the solution and runs the code if no build errors are encountered. Any build errors that occur are displayed in the Error List window. You can also start the application without using the debugger by pressing CTRL+F5 or by opening the Excel or Word document directly. In either case, the code will run, but you will not be able to debug any errors. This is nice way to test the end user's experience of working with your VSTO solution.

Whenever you build a VSTO project, Visual Studio grants full trust by default (referring to a new .NET security layer known as code access security) to the project assemblies using URL evidence (the directory in which you are running the code). If you move your project to a new location and rebuild it, the permissions for the original location are removed, and new permissions are granted. This means that as long as you are developing your solution, the solution will be granted the permissions needed to run the code on your development machine. But if you move the document or assembly to another folder on your computer without first compiling the code, you will most likely get a security error or a "cannot load assembly" error. If you deploy the solution, you need to set security permissions on the end user's machine, or else the .NET Framework will prevent execution of the code. In Chapter 11 you will learn more about security and deployment.

You can remove the built files from the output directory by clicking Clean Solution on the Build menu. Whenever you run the Rebuild command, Visual Studio first removes the files from the output directory and then rebuilds the solutions. When you click Clean Solution in an add-in, the add-in is removed from the registry and no longer loads when the application is opened.

0 0

Post a comment