New System definition using SDM SDK

Hi,

I'm trying to create a new SDM system definition using the SDM SDK. I'm using Visual Studio TS Beta2.

I successfully compile my .sdm file, I'm able to create manager dll using SdmG and CSC and I also create a prototype for toolbox using protogen tool.

When I install my sdmDocument into VS (by adding required entries into registry - EnterpriseTools\Sdm\InitializationFiles and EnterpriseTools\DesignerPrototypeFolders) I see an entry in my toolbox with my system. However, when I drag-and-drop it onto the distributed system designer surface, the designer seems to ignore the definition completely. It displays default system shape, the system type is set to "Application Definition" and is underlined in red. I'm not even able to move the shape using mouse. I see no contraints or settings. I'm not able to add any endpoints to it.

I beleive, I did everything according to the SDM SDK documentation, but the definition is apparently not working in VS.

Do you have any ideas what should I do to make my definition work in VS

Thanks,

--Jan



Answer this question

New System definition using SDM SDK

  • Naokazu Tsukada

    Sorry you are having trouble with the model. I was able to successfully compile your files and MyService works on my machine as intended, so your code seems to be working (I was able to move MyService from toolbox to my design surface on AD, etc).

    Before I engage heavily into debugging the product, let's try something very simple: close all your VS windows, find devenv.exe file (that's where VS starts up from), open a command line, and run >[path to VS]\devenv.exe /resetuserdata.
    It will reset user data and clean up the toolbox cache. Please, wait for it to finish and then start new VS.

    The reason I am asking you to do it is because I suspect that there is the "wrong" prototype sitting somewhere in toolbox cache.

    Please, let me know if it works.
    Thanks,
    DmitriyN

  • WEM

    When you see the red border around the system definition, is there any message in Error List

  • helpmeimstupid

    Most likely there is one of the two issues there:
    1) The file MyOrg.Service.sdmDocument is not present in the directory specified in the registry. Make sure the file is .sdmDocument, not .sdm
    2) The registry entry is wrong.
    The registry entry should be in the form:
    Name  -anything;
    Value - [c:\directorypath]\MyOrg.Service.sdmdocument
    Path should be to sdmdocument, not .sdm.

    If this does not work, you can email me the registry entry if you want me to take a look.

    Thanks, 

  • Achelon

    After having done devenv /resetuserdata it started to work, great!!

    Just one question, do I have to run devenv /resetuserdata every time I change my SDM documents and/or prototypes

    Thanks,

    --Jan


  • Frustrated1689

    I have the following registry entry:
    Name - 240 MyOrg.Service.sdm
    Value - C:\VS8\Common7\IDE\PrivateAssemblies\MyOrg.Service.sdmDocument

    It seems like the VS is unable to parse my sdmDocument file for some reason. The path in registry is correct, I checked it by trying the same path in notepad and it worked. My manager DLL is in the same directory as the MyOrg.Service.sdmDocument.

    I'm attaching sources of my SDM file, MSBuild project and AssemblyInfo.cs. Could you please look at those if there is some error in there

    Thanks,

    --Jan


    The content of the original sdm file (before compilation) is:

    < xml version="1.0" encoding="utf-8" >
    <SystemDefinitionModel Name="MyOrg.Service" Version="1.0.50207.1" DocumentLanguage="en" xmlns="
    http://schemas.microsoft.com/SystemDefinitionModel/2005/1">
       <Information>
          <FriendlyName>Web Service model</FriendlyName>
          <CompanyName>MyOrg Corporation</CompanyName>
          <Copyright>Copyright (c) MyOrg Corporation.  All rights reserved.  This is provided AS IS with no warranties, and confers no rights.</Copyright>
          <Description>
             <Entry Name="Description" ResourceId="MyOrg.Service" Manager="ServiceAppManager">SDM model for Web Service.</Entry>
          </Description>
       </Information>
       <Import Alias="WebApp" Name="Microsoft.WebApplication"/>
       <Import Alias="WindowsHost" Name="Microsoft.WindowsHost"/>
       <Import Alias="System" Name="System"/>
       <Import Alias="Web" Name="Microsoft.Web"/>
       <Import Alias="DA" Name="Microsoft.DistributedApplication"/>
       <Import Alias="WebHost" Name="Microsoft.WebHost"/>
       <Import Alias="GenericHost" Name="Microsoft.GenericHost"/>
       <Import Alias="Data" Name="Microsoft.Data"/>
       <Import Alias="DatabaseServer" Name="Microsoft.DatabaseServer"/>
       <Import Alias="Generic" Name="Microsoft.Generic"/>
       <DesignData>
          <VisualStudio xmlns="
    http://schemas.microsoft.com/SystemDefinitionModel/2005/1/DesignData/VisualStudio">
             <ModelElement Type="Microsoft.VisualStudio.EnterpriseTools.LogicalInfrastructureDesign.Modeling.HostLayerDocument">
                <Property Name="DocumentType" Value="AbstractTypes" />
             </ModelElement>
          </VisualStudio>
       </DesignData>
       <Manager Name="ServiceAppManager" AssemblyName="MyOrg.Sdm.Service" SourcePath="MyOrg.Sdm.Service.dll" />
       <ContainmentDefinition Name="ServiceContainsDataClient" ParentDefinition="MyService" MemberDefinition="Data:DataClient" />
       <ContainmentDefinition Name="DistributedApplicationContainsService" ParentDefinition="DA:DistributedApplication" MemberDefinition="MyService" />
       <ContainmentDefinition Name="ServiceContainsWebContentClient" ParentDefinition="MyService" MemberDefinition="Web:WebContentClient" />
       <ContainmentDefinition Name="ServiceContainsWebServiceClient" ParentDefinition="MyService" MemberDefinition="Web:WebServiceClient" />
       <SystemDefinition Name="MyService" Layer="Application" Abstract="true">
          <Description>
             <Entry Name="DisplayName" ResourceId="Service.DisplayName" Manager="ServiceAppManager">MyService</Entry>
             <Entry Name="Description" ResourceId="Service.Description" Manager="ServiceAppManager">Contains the definitions of the Web Service definition.</Entry>
          </Description>
          <DesignData>
             <Report Type="Application" xmlns="
    http://schemas.microsoft.com/SystemDefinitionModel/2005/1/DesignData/DeploymentReport" />
             <VisualStudio xmlns="
    http://schemas.microsoft.com/SystemDefinitionModel/2005/1/DesignData/VisualStudio">
                <ModelElement>
                   <Property Name="PrimaryRelationshipName" Value="HostingDefinition" />
                   <Property Name="PrimaryRelationshipRole" Value="Guest" />
                   <Property Name="DefaultRootName" Value="Service1" />
                   <Property Name="ThemeColor" Value="34, 83, 213" />
                   <Property Name="ImageFileName" Value="GenericApplication.emf" />
                   <Property Name="ErrorImageFileName" Value="GenericApplicationError.emf" />
                </ModelElement>
             </VisualStudio>
          </DesignData>
       </SystemDefinition>
       <HostingDefinition Name="GenericServerHostsService" GuestDefinition="MyService" HostDefinition="GenericHost:GenericServer" />
       <HostingDefinition Name="DatabaseServerHostsService" GuestDefinition="MyService" HostDefinition="DatabaseServer:DatabaseServer" />
       <ContainmentDefinition Name="ServiceContainsServiceClientEndpoint" ParentDefinition="MyService" MemberDefinition="Generic:GenericApplicationClientEndpoint" />
       <HostingDefinition Name="WindowsHostHostsService" GuestDefinition="MyService" HostDefinition="WindowsHost:WindowsHost" />
       <ContainmentDefinition Name="ServiceContainsServiceEndpoint" ParentDefinition="MyService" MemberDefinition="Generic:GenericApplicationEndpoint" />
       <HostingDefinition Name="WebServerHostsService" GuestDefinition="MyService" HostDefinition="WebHost:WebServer" />
    </SystemDefinitionModel>

    I'm using following MSBuild project file:

    <!-- Copyright (c) Microsoft Corporation.  All rights reserved.  This is provided AS IS with no warranties, and confers no rights. -->

    <Project DefaultTargets='SdmG;Compile;SdmProtoGen;SdmC' xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

        <!-- General properties -->
        <PropertyGroup>
            <OutputPath>bin\</OutputPath>
        </PropertyGroup>

        <!-- SdmC.exe properties -->
        <PropertyGroup>
            <SdmSourceFile>MyOrg.Service.sdm</SdmSourceFile>
            <SdmTargetFile>$(SdmSourceFile)Document</SdmTargetFile>
        </PropertyGroup>
       
        <!-- SdmC.exe items -->
        <ItemGroup>
            <SdmReference Include="Microsoft.Configuration.sdmDocument"/>
            <SdmReference Include="Microsoft.Data.sdmDocument"/>
            <SdmReference Include="Microsoft.DistributedApplication.sdmDocument"/>
            <SdmReference Include="Microsoft.FileSystem.sdmDocument"/>
            <SdmReference Include="Microsoft.InternetInformationServices.sdmDocument"/>
            <SdmReference Include="Microsoft.OperatingSystem.sdmDocument"/>
            <SdmReference Include="Microsoft.WindowsApplication.sdmDocument"/>
            <SdmReference Include="Microsoft.WindowsHost.sdmDocument"/>
            <SdmReference Include="Microsoft.Generic.sdmDocument"/>
            <SdmReference Include="Microsoft.Web.sdmDocument"/>
            <SdmReference Include="Microsoft.WebHost.sdmDocument"/>
            <SdmReference Include="Microsoft.WebApplication.sdmDocument"/>
            <SdmReference Include="Microsoft.DatabaseServer.sdmDocument"/>
            <SdmReference Include="Microsoft.GenericHost.sdmDocument"/>
            <SdmReference Include="System.Constraints.sdmDocument"/>
            <SdmReference Include="System.Flow.sdmDocument"/>

            <SdmReferenceSearchPath Include="$(SdmModelsDir)"/>
        </ItemGroup>

        <!-- Prototype generator properties -->
        <PropertyGroup>
            <PrototypeOutput>$(OutputPath)MyOrg.Service.adPrototype</PrototypeOutput>
            <PrototypeType>System</PrototypeType>
            <PrototypeLayer>Application</PrototypeLayer>
            <PrototypeDocument>MyOrg.Service</PrototypeDocument>
            <PrototypeTypeName>MyService</PrototypeTypeName>
            <PrototypeName>MyServiceId</PrototypeName>
            <PrototypeBitmap></PrototypeBitmap>
            <PrototypePosition></PrototypePosition>
            <PrototypeCaption></PrototypeCaption>
        </PropertyGroup>
       
        <!-- SdmG.exe properties -->
        <PropertyGroup>
            <ManagerAssemblyName>MyOrg.Sdm.Service</ManagerAssemblyName>
            <ManagerFileName>$(ManagerAssemblyName).dll</ManagerFileName>
            <GeneratedClassFile>MyOrg.Service.cs</GeneratedClassFile>
            <GenerateClasses>true</GenerateClasses>
            <GenerateResources>true</GenerateResources>
            <GeneratedResourceFile>$(ManagerAssemblyName).resources</GeneratedResourceFile>
            <SdmNoLogo>true</SdmNoLogo>
            <ResourceTextFile>MyOrg.Service.Resources.txt</ResourceTextFile>
        </PropertyGroup>
       
        <!-- Csc properties for the manager -->
        <PropertyGroup>
            <AssemblyName>$(ManagerAssemblyName)</AssemblyName>
            <OutputType>Library</OutputType>
            <NoLogo>true</NoLogo>
            <Configuration>Retail</Configuration>
            <Platform>AnyCPU</Platform>
            <IntermediateOutputPath>$(OutputPath)</IntermediateOutputPath>
        </PropertyGroup>
        <ItemGroup>
            <Compile Include="$(OutputPath)MyOrg.Service.cs"/>
     <Compile Include="AssemblyInfo.cs"/>
            <ManifestResourceWithNoCulture Include='$(OutputPath)$(GeneratedResourceFile)'/>
            <Reference Include="System.Xml" />
        </ItemGroup>

        <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />

        <!-- Have to import the SDM targets after the CSharp targets -->
        <Import Project="$(SdmToolsDir)\Microsoft.SystemDefinitionModel.Targets" />

    </Project>

    The AssemblyInfo.cs contains:

    using System.Reflection;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;

    // General Information about an assembly is controlled through the following
    // set of attributes. Change these attribute values to modify the information
    // associated with an assembly.
    [assembly: AssemblyTitle("MyOrg.Sdm.Service")]
    [assembly: AssemblyDescription("")]
    [assembly: AssemblyConfiguration("")]
    [assembly: AssemblyCompany("MyOrg")]
    [assembly: AssemblyProduct("MyOrg.SDM")]
    [assembly: AssemblyCopyright("Copyright MyOrg 2005")]
    [assembly: AssemblyTrademark("")]
    [assembly: AssemblyCulture("")]

    // Setting ComVisible to false makes the types in this assembly not visible
    // to COM componenets.  If you need to access a type in this assembly from
    // COM, set the ComVisible attribute to true on that type.
    [assembly: ComVisible(false)]

    // The following GUID is for the ID of the typelib if this project is exposed to COM
    [assembly: Guid("4bd3aca1-fcfd-4492-9650-45cda68658e4")]

    // Version information for an assembly consists of the following four values:
    //
    //      Major Version
    //      Minor Version
    //      Build Number
    //      Revision
    //
    [assembly: AssemblyVersion("1.0.50207.1")]
    [assembly: AssemblyFileVersion("1.0.50207.1")]



  • David_W

    Yes, there is:

    Error 1 The SDM file "Application1_15.sdm" could not reference the file MyOrg.Service (version 1.0.0.0).  


  • wromee

    >>Just one question, do I have to run devenv /resetuserdata every time I change my SDM documents and/or prototypes

    Hopefully notSmile You most definitely don't have to do it for SDM documents even now (as the problem is prototype-related), and AFAIK, in the released version you will not have to do it for prototypes as well. I will double-check that, and make sure it is thoroughly tested by our excellent (and I am not kidding here) QA department.

    In any case, if it still be a known issue when released, there will be guidance provided in the documentation about resolving it.

    I have a request for you too:) Can you, please mark this thread as "answered" so that other developers can use it to solve the same issue.

    Best Regards,
    DmitriyN



  • New System definition using SDM SDK