共用方式為


How to: Copy Model and Mapping Files to the Output Directory

The ADO.NET Entity Data Model Designer (Entity Designer) enables you to copy model and mapping files to the output directory. By default, these files are embedded as resources in the application assembly.

To copy model and mapping files to the output directory

  1. Double-click the .edmx file in Solution Explorer.

    The file opens in the Entity Designer.

  2. Right-click an empty section of the design surface and select Properties.

    The Visual Studio Properties window appears.

  3. Set the value of the Metadata Artifact Processing property to Copy to Output Directory.

When you save the .edmx file, the Entity Designer modifies the connection string in the App.config file or Web.config file to indicate to the Entity Framework where the model and mapping files are located. (For more information about connection strings, see Connection Strings (Entity Framework).) When you build the project, the model and mapping files are copied to the project's bin\Debug folder.

See Also

Other Resources

Deployment Considerations (Entity Framework)
Deployment Tasks with the Entity Designer
Entity Data Model Tools Tasks
ADO.NET Entity Data Model Designer Scenarios
Entity Data Model Tools