how can one copy Entity Framework model (edmx) from one WPF solution to another in VS 2010
? Simple Ctrl-C + Ctrl-V doesn't work.
Copy it from the folder and place in another. Then using Add >> Existing Items >>
Its wiser to regenerate in the new project in case if there are any other dependencies created elsewhere in application.
Looks like you are trying to share EDMX between two solutions, aren't you? In such case isn't it better to have EDMX, context and all entities in the separate assembly and share either compiled assembly or the whole project (add existing project to the second solution)? You can also share the EDMX file itself by Add existing item as a link. Anyway when adding the EDMX file to the second solution you will also need to add its .Designer.cs
file (unless you are using T4 templates). For this you will have to edit .csproj
file manually (open it as XML). Make sure that your .csproj
file contains sections like:
<ItemGroup>
<Compile Include="Model.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Model.edmx</DependentUpon>
</Compile>
<!-- other files included in the project -->
</ItemGroup>
<ItemGroup>
<EntityDeploy Include="Model.edmx">
<Generator>EntityModelCodeGenerator</Generator>
<LastGenOutput>Model.Designer.cs</LastGenOutput>
</EntityDeploy>
</ItemGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With