STAAD.Pro Help

OS. Start Your C# Project

This quick set of steps demonstrates how to set up your workspace for a C# project.

This procedure is adapted from a similar tutorial at https://docs.microsoft.com/en-us/visualstudio/get-started/csharp/tutorial-console.
  1. In the Visual Studio start window, click Create a new project. The Create a new project window opens.
  2. Filter the project templates using the following:
    1. Type console in the search field.
    2. Select C# from the Language drop-down list.
    3. Select Windows from the Platform drop-down list.
  3. Select the Console App (.NET Framework) from the results and then click Next. The Configure your new project window opens.
  4. Type OpenSTAAD Demo in the Project Name field.
  5. Click Create. Visual Studio opens your new project, which includes default "Hello World" code.
  6. Add necessary dependencies to the manifest file:
    1. Right-click on your project's name and then select New Item > Application Manifest File. The template for the app.manifest file opens.
    2. Add the following elements within the <assembly> element:
      <comInterfaceExternalProxyStub name="IOSMemberSteelDgnParams" iid="{F40BDCDA-B3DE-495C-B84F-790F4456137F}" tlbid="{EDA9FA7F-EFC9-4264-9513-39CF6E72604D}" proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
      <comInterfaceExternalProxyStub name="IOpenSTAADUI" iid="{3F5B8055-31C6-446E-8BED-FEE43E09D4CC}" tlbid="{EDA9FA7F-EFC9-4264-9513-39CF6E72604D}" proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
      <comInterfaceExternalProxyStub name="IOSGeometryUI" iid="{C052FED9-A2D6-42E3-A271-2C6FB8461711}" tlbid="{EDA9FA7F-EFC9-4264-9513-39CF6E72604D}" proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
      <comInterfaceExternalProxyStub name="IStaadProWindow" iid="{9EF2FF8C-E574-4A04-9462-2E4500C8EADB}" tlbid="{EDA9FA7F-EFC9-4264-9513-39CF6E72604D}" proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
      <comInterfaceExternalProxyStub name="IOSViewUI" iid="{87B1975B-6031-487E-A0F9-FB8F69FA24E6}" tlbid="{EDA9FA7F-EFC9-4264-9513-39CF6E72604D}" proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
      <comInterfaceExternalProxyStub name="IOSOutputUI" iid="{824F1FC0-DC86-4CC4-A4C6-83C77D7B0496}" tlbid="{EDA9FA7F-EFC9-4264-9513-39CF6E72604D}" proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
      <comInterfaceExternalProxyStub name="IOSPropertyUI" iid="{F919EF7D-E1DD-48CB-B3C3-B3CAE9E3B5AB}" tlbid="{EDA9FA7F-EFC9-4264-9513-39CF6E72604D}" proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
      <comInterfaceExternalProxyStub name="IOSLoadUI" iid="{DAA37D16-821F-4137-88EB-DA4EB7650E90}" tlbid="{EDA9FA7F-EFC9-4264-9513-39CF6E72604D}" proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
      <comInterfaceExternalProxyStub name="IOSTableUI" iid="{CF1A7B89-A007-4844-A098-CBABAEBEF304}" tlbid="{EDA9FA7F-EFC9-4264-9513-39CF6E72604D}" proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
      <comInterfaceExternalProxyStub name="IOSSupportUI" iid="{B076EC62-9A33-4E1C-B38C-3E45090B8531}" tlbid="{EDA9FA7F-EFC9-4264-9513-39CF6E72604D}" proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
      <comInterfaceExternalProxyStub name="IOSCommandsUI" iid="{6B994A7C-122C-4828-B42B-1B0CADF91F9D}" tlbid="{EDA9FA7F-EFC9-4264-9513-39CF6E72604D}" proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
      <comInterfaceExternalProxyStub name="IOSDesignUI" iid="{ED218322-40EE-411C-8552-209DB2C4F32B}" tlbid="{EDA9FA7F-EFC9-4264-9513-39CF6E72604D}" proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
    3. Save and close the manifest file.
  7. Add the staadpro.dll dependency to the project file: This adds OpenSTAAD as a COM file reference.
    1. Open the project's .csproj file. This file is located at the rood directory of the project.
    2. Add the following element to the start of the ItemGroup element:
      <COMFileReference Include="C:\Program Files\Bentley\Engineering\STAAD.Pro CONNECT Edition\STAAD\StaadPro.dll">
            <EmbedInteropTypes>True</EmbedInteropTypes>
      </COMFileReference>
    3. Save and close the project file.
  8. Add the manifest to the build:
    1. In the Solutions Explorer, right-click on the project and then select Properties from the pop-up menu.
    2. Select the Build Events tabs.
    3. Add the following to the post-build event command line:
      copy $(ProjectDir)app.manifest $(TargetDir)\$(AssemblyName).exe.manifest