开发者

Force "2005" for ProviderManifestToken in EF Data Model

Every time I update my da开发者_高级运维ta model, it makes this value 2008, breaking the 2005 server deployment. Is their anything besides a build action I can use to stop this?


Using the MSBuild.Community Tasks, I added a BeforeBuild Target that uses the XmlUpdate task to always change the ProviderManifestToken to 2005, in case someone changed it by updating the data model.

Here is the BeforeBuild Target:

<Target Name="BeforeBuild">
<XmlUpdate Prefix="ssdl"
            Namespace="http://schemas.microsoft.com/ado/2009/02/edm/ssdl"
            XPath="//ssdl:Schema/@ProviderManifestToken"
            XmlFileName="Model.edmx"
            Value="2005"/>


If you connect to a 2005 DB/server when you update, then it will stay at 2005. That, or manual editing, are the only ways I know.


I found this question because I needed to prevent the EDMX from upgrading to Sql Server 2012 (from 2008). I also used MSBuild.CommunityTasks, but used a slightly more generic XPath expression to avoid using the namespace (which has changed from what's shown in jnosek's answer):

    <XmlUpdate XmlFileName="Orders\Model.edmx" 
            XPath="//*[local-name() = 'Schema']/@ProviderManifestToken"
            Value="2008"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜