2010-11-29 4 views
0

기술 : 비주얼 스튜디오 2010, 우리는 우리가 새로운 버전을 출시 할 때 우리는 버전 번호를 증가 할, 상업 비주얼 스튜디오 2010 DSL이 & 모델링 SDKdslVersion - 증가하는 방법이지만 이전 버전을 계속 지원합니까?

Visual Studio를 시각화. DslDefinition.dsl을 열고 필요에 따라 버전 번호를 업데이트 한 다음 모든 템플릿을 변형하여 변경 내용을 반영합니다. DslPackage 'source.extension.vsixmanifest'는 잘 업데이트되고 새로운 버전 번호를 보여줍니다.

그러나 문제는 누군가가 버전 1.0.0.0에서 만든 모델을 업데이트 된 버전 1.0.0.1로 열면 모델을 열 수 없기 때문에 그 이유는 해당 모델의 'dslVersion'이 * .diagram 파일이 구형 인 1.0.0.0으로 설정되었으므로 수동으로 dslVersion을 업데이트하여 해결할 수 있지만 지원되는 버전 범위를 설정할 방법이없는 것으로 보입니다.

수정 사항이 있습니까?

답변

1

'* SerializationHelper'클래스에있는 'CheckVersion'메서드를 재정 의하여이 문제를 해결했습니다. 내 구현은 다음과 같습니다.

 partial class ProductSerializationHelper 
    { 
     protected override void CheckVersion(Microsoft.VisualStudio.Modeling.SerializationContext serializationContext, System.Xml.XmlReader reader) 
     { 
      #region Check Parameters 
      global::System.Diagnostics.Debug.Assert(serializationContext != null); 
      if (serializationContext == null) 
       throw new global::System.ArgumentNullException("serializationContext"); 
      global::System.Diagnostics.Debug.Assert(reader != null); 
      if (reader == null) 
       throw new global::System.ArgumentNullException("reader"); 
      #endregion 

      global::System.Version expectedVersion = new global::System.Version("2.5.0.0"); 
      string dslVersionStr = reader.GetAttribute("dslVersion"); 
      if (dslVersionStr != null) 
      { 
       try 
       { 
        global::System.Version actualVersion = new global::System.Version(dslVersionStr); 

// #### THIS IS WHERE I CHANGED FROM '!=' to '>' 
        if (actualVersion > expectedVersion) 
        { 
         ProductSerializationBehaviorSerializationMessages.VersionMismatch(serializationContext, reader, expectedVersion, actualVersion); 
        } 
       } 
       catch (global::System.ArgumentException) 
       { 
        ProductSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "dslVersion", typeof(global::System.Version), dslVersionStr); 
       } 
       catch (global::System.FormatException) 
       { 
        ProductSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "dslVersion", typeof(global::System.Version), dslVersionStr); 
       } 
       catch (global::System.OverflowException) 
       { 
        ProductSerializationBehaviorSerializationMessages.InvalidPropertyValue(serializationContext, reader, "dslVersion", typeof(global::System.Version), dslVersionStr); 
       } 
      } 
     } 
    } 
관련 문제