If you have a .NET Framework 4.5 project that contains a v2 edmx file and don't have a reference to any EF dll in your project retargeting to .NET Framework 4 will change the schema to v3
Steps
1. Have a v2 edmx file
2. Create a new .NET Framework 4.5 Console App project
3. Add the v2 edmx file to the project
4. Retarget the project to .NET Framework 4
5. Try opening the edmx
Expected:
Edmx file can be opened and contents should be visible
Actual:
Edmx file cannot be open. The reason is that the version of the edmx was upgraded to v3
Fix:
In the RetargetingHandler.RetargetFilesInProject() when getting target schema version we don't pass a flag that indicates that we want the 1:1 mapping between .NET Framework version and EF schema version (so for .NET Framework 4 it should be v2). As a result we receive the latest schema version for the targeted .NET Framework which - for .NET Framework 4 - returns v3 (because of EF6 support for .NET Framework 4)
Comments: Verified as fixed
Steps
1. Have a v2 edmx file
2. Create a new .NET Framework 4.5 Console App project
3. Add the v2 edmx file to the project
4. Retarget the project to .NET Framework 4
5. Try opening the edmx
Expected:
Edmx file can be opened and contents should be visible
Actual:
Edmx file cannot be open. The reason is that the version of the edmx was upgraded to v3
Fix:
In the RetargetingHandler.RetargetFilesInProject() when getting target schema version we don't pass a flag that indicates that we want the 1:1 mapping between .NET Framework version and EF schema version (so for .NET Framework 4 it should be v2). As a result we receive the latest schema version for the targeted .NET Framework which - for .NET Framework 4 - returns v3 (because of EF6 support for .NET Framework 4)
Comments: Verified as fixed