Managing projects overview
When you work in Microsoft Expression Blend, all files are organized into a single project folder. This project system helps you manage all your working files and references in an efficient way, keeping them all in a local folder tree in the Project panel.
The project system also makes it easy to test just a startup document or a whole project, and then build the project to a specific location when you are ready. The final product that you produce after you build a project depends on the project type:
A Windows Presentation Foundation project builds a standard Microsoft Windows-based application (.exe).
A Microsoft Silverlight 1.0 project builds a website application.
A Silverlight 2 project builds a Silverlight 2 application (.xap) and supporting files, which include an HTML test page that will load your application in a browser window.
Just as web documents are based on unique markup languages such as HTML, Expression Blend documents are also based on a unique markup language, Extensible Application Markup Language (XAML). In Expression Blend you can create new XAML documents, open, save, and delete existing documents, and even copy and rename documents, just as you can in many other applications. Expression Blend also provides basic project recovery functionality and the ability to discard projects. You can accomplish most document-related tasks by using the commands that are located on the File, Edit, and Project menus. You can even right-click documents in the Project panel and perform basic tasks quickly by using the shortcut menu. By default, Expression Blend creates a .csproj or .vbproj file for your WPF and Silverlight 2 projects, but also supports Microsoft Visual Studio solution files (.sln). For your Silverlight 1.0 projects, Expression Blend creates a website folder with no project or solution files. For a roadmap of the Project panel, see Project panel.
The References folder is used to store assemblies such as DLLs and executables. An assembly might be a user control .dll that you created in Expression Blend, a .NET Framework custom control, or a compatible COM component. For more information, see Add or remove a reference.
Resource dictionaries contain reusable resources such as brush colors, styles and templates for controls, and other data types that you can assign to a property. Resource dictionaries are linked to your project by dictionary references in the App.xaml file or in another resource dictionary file. For more information, see Create, export, or import a resource dictionary and Resources overview. A resource dictionary is just one type of XAML document that you can author in Expression Blend. Additional XAML documents include windows, pages, and user controls.
When you add a new or existing item to a project, the item appears in the Files list. Items include XAML documents, images, audio files, video files, 3D objects, 3D materials files, and more. You can create and add XAML documents to your project by using New Item on the File menu. Existing files are added to your project by using Add Existing Item on the Project menu. For more information, see Create a new document or project, Add, link to, or remove an existing item from a project, or Add an image, audio, or video file to a project.
You can link to existing items that don't live locally in your project folder but are stored elsewhere. Items include XAML documents, images, audio files, video files, 3D objects, 3D materials files, and others. A linked item is identified by an arrow superimposed over the file icon in the Files list. For more information, see Add, link to, or remove an existing item from a project.
The code-behind file for a XAML document shows as a child item under its respective XAML document. You can create a code file for a XAML document every time that you create a new XAML document by selecting the Include code file check box in the Add New Item dialog box. Code-behind files are typically used to run a procedure that involves more than setting a property or controlling an animation timeline (which can be done without code in your XAML document). For example, in a code-behind file, you can add other programming logic such as setting a property on another object, loading a new document, creating a new object, using a mathematical calculation to animate an object, and so on. For information about how to work with code-behind files, see Edit a code-behind file and Create a new event handler method. For a comparison of what can be done with and without code, see Code editing and Visual Studio 2008 interoperability. You might also add code files for custom classes to your project.
The App.xaml file
An App.xaml file and corresponding code-behind file are created by default in an Expression Blend project. The App.xaml file contains application-level resources that any document in your application can use. Application-level resources are listed in the Resources panel under the App.xaml node. You can add resources to the App.xaml file by selecting Application in the Create Resource window. For more information, see Resources overview and Create a resource.
The AssemblyInfo.cs file
By default, an AssemblyInfo.cs file is created in an Expression Blend project. The AssemblyInfo.cs file contains settings for your project that are used when you compile your application. Do not modify the AssemblyInfo.cs file.
The project and solution file
A project file (.vbproj or .csproj) and a solution file (.sln) file are created for WPF applications in Expression Blend. These files are compatible with Microsoft Visual Studio 2008.
Managing your project files requires some diligence, because renaming and moving documents and items in your project folder can lead to broken links and references. For this version of Expression Blend, practice keeping your renaming and moving tasks to a minimum and remember that if you do rename or move an item or reference, you'll have to manually update all references to those renamed or moved items and references to make sure that your project works as expected. Do not rename or delete the App.xaml files or the AssemblyInfo.cs file.
When you add a new or existing item to a project, the item appears in the Files list. Items include XAML documents, images, audio files, video files, and more. You can create and add XAML documents to your project by using New Item on the File menu. Existing files are added to your project by using Add Existing Item on the Project menu. For more information, see Create a new document or project, Add, link to, or remove an existing item from a project, or Add an image, audio, or video file to a project.
The code-behind file for the starting XAML document. Code-behind files are typically used to run a procedure that involves more than setting a property. For example, in a code-behind file, you can add other programming logic such as setting a property on another object, controlling an animation timeline, loading a new document, creating a new object, using a mathematical calculation to animate an object, and so on. For information about how to work with code-behind files, Create a hyperlink in a Silverlight application, Create a button that controls a storyboard in a Silverlight application, and Control the playback of media in a Silverlight project.
You can configure the following options in the Project tab of the Options dialog box (Tools menu). These options affect how you create new projects in Expression Blend:
Save new projects to the Expression Blend Projects folder This setting automatically saves your new project to disk in the Expression Blend projects folder, or in the folder that you specified in the Location box of the Create New Project dialog box. Until you save a project to disk, the project is in a temporary state, and some features (such as viewing events or browsing the project) are unavailable.
Create a temporary project on startup This setting automatically creates a temporary empty project when you start Expression Blend. This temporary project will not be saved to disk automatically, regardless of the previous setting.
Use a Grid panel as the default layout for new items This setting uses a Grid panel element as the root layout element in your document. If you do not select this setting, a Canvas panel element is used as the root layout element in your document.
Warn about project files that are opened from outside Expression Blend by using the Open With command in Windows Explorer or Visual Studio, or by double-clicking the files This setting will display a warning when you open a project from outside of Expression Blend. People often use this method to open projects that they have obtained from an outside source. The warning is a reminder to only open projects if you trust the authors of those projects.
If the Expression Blend process is interrupted when you are working on a temporary project, you will be given an opportunity to recover your project the next time that you open Expression Blend. A Project Recovery dialog box will appear, with the following options:
Recover Recovers the last project that you were working on, restoring it to the state it was in the last time that you saved a document.
Discard Discard the last project that you were working on.
Cancel Postpone the decision until the next time that you open Expression Blend.
Expression Blend provides basic testing functionality so that you can test your project before you build. When you test your project, the document that is identified as the Startup page is displayed first. The project will always open the Startup page first. The Expression Blend build process uses the new Microsoft build platform, MSBuild. MSBuild defines both what you'll be building in addition to how you’ll build it. For more information about MSBuild, see the MSBuild Overview on MSDN. Signing and other release-related tasks such as debugging, securing, and deploying your project must be managed through Visual Studio or Visual Studio Express. See the following topics for more information about these tasks: