Getting Started with MicroStation SDK and Visual Studio 2017

Ok So I have installed MicroStation CE Update 13

I have Visual Studio 2017 Pro with relevant add-ins.

I have installed the MicroStation CE Updated 13 SDK.

And then I get stuck....on getting up and running

The only included documentation in the latest SDK is 6 year out of date and incomplete and does not work.

The only u-tube video on the subject is out of date and does not work.

I cannot find anything on the learn server.

So how do I get started here?

Does any one have step by step instructions on how to get Visual Studio 2017 working with MicroStation and the SDK from the point of installation of the apps and the SDK?

Any help gratefully received.

With Hope

Stephen Holmes

Parents
  • Hi Both,

    Apologies for not giving more detail.

    I have written windows form apps in C# and VB.net (none MicroStation), I have written extensively VBA apps in MicroStation.
    I want to move into writing apps for MicroStation in C# and/or C++ .
    I've been using MicroStation for 30 years.

    So I want to get started with C# and/or C++ app writing in MicroStation

    At this stage my aim is to write a simple MicroStation app in C#  - just to draw one line from point A to Point B to make sure the developer environment is working OK,
    and to allow me to write in Visual Studio and run the app in MicroStation, debugging in Visual Studio.

    So what I have done so far....

    I have a brand new windows 10 computer with all the latest windows 10 updates...

    I have installed Visual Studio 2017 Pro 

    I have installed MicroStation Update 13

    I have installed MicroStation Update 13 SDK

    I have launched the SDK with the icon on the desktop (running as administrator)

    I have typed buildallexamples.bat

    All examples appear to have built successfully (a couple flashed up red with a dependency missing warning)

    I click N to not view the log files

    I then typed DEVENV

    I get error 'devenv' is not recognised and an internal or external command, operable program or batch file

    Where did I go wrong so far?

    My reference points for how to install and set up Vis Studio with the SDK have been:

    https://www.youtube.com/watch?v=gjROBS4T1oo Swarnilla Sett's video from 2018

    "C:\Program Files\Bentley\MicroStationCONNECTSDK\Documentation\Readme\index.html"

    The quickinstall guide here only goes as far as downloading and running the installer of the SDK.

    "C:\Program Files\Bentley\MicroStationCONNECTSDK\Documentation\Migration\Using MicroStation x64 Beta 1 MDL SDK\Using MicroStation x64 Beta 1 MDL SDK-v2.pdf"

    This appears to be a document from the early Beta versions of the SDK from several years ago and section 6 starts writing  bat files to launch the environment which appears to be incorrect and out of date.

    Have I missed a document somewhere that tells me how to install and set up the environment to work with Viz Studio 2017?

    What have I done wrong so far in trying to get the environment to launch correctly?

    Thank you in advance for you help.

    Regards

    Stephen

  • Hello Stephen,

    you could start your VIZ2017 with: 

    C:\"Program Files (x86)"\"Microsoft Visual Studio"\2017\Professional\Common7\IDE\devenv.exe /useenv

    inside the Bentley shell. (maybe your path is a litte differ) "/useenv" tells VIZ2017 to use the variables from the shell, i. e. include, lib, etc.

    Mit freundlichen Grüßen / Best regards
    Volker Hüfner

    |  AB_DATE Engineering  Software   |  ab-date.de  |

  • I think one of the shortened paths for one of the environment variables is

    You are welcome :-)
    It is much easier to use DOS8.3 notation. But be careful, the could change, that happend once with a windows update. 

    It is best to create the DOS8.3 names fresh each time. I got a batch from  at the last MDL-workshop in 2015. This could help:

    ECHO.
    ECHO.
    ECHO ========================================================
    ECHO == Show mangled (DOS 8.3 format) path and file name 
    ECHO == of path provided, 
    ECHO == or current directory if no arg provided
    ECHO ========================================================
    
    
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: mangled
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    ECHO.
    ECHO.
    IF /i {%1}=={} (
       CD
       ECHO.
       FOR /f "tokens=*" %%D IN ('cd') DO ECHO %%~sD
    ) else (
       ECHO %1
       ECHO.
       FOR %%A IN (%1) DO ECHO %%~sA
    )
    ECHO.
    ECHO.
    

    Mit freundlichen Grüßen / Best regards
    Volker Hüfner

    |  AB_DATE Engineering  Software   |  ab-date.de  |

  • Hi ,

    Just some quick insights and recommendation that may help...

    1. I along with other developers are actively working on improving first time new (vs. existing experienced) developer experience.  Some area we are focused on improving are: Bentley APIs and SDKs (resource map), SDK Overviews and Getting Started, Workflow and Task oriented Wikis and videos, new Training content, Blogs, Visual Studio Extensions. For 2020 all adding and accelerating the prior items, plus: extending and opening up more MicroStation SDK features and Developer web site (portal) focused content and improvements.
    2. With the above ongoing activity, to help you along (like our very helpful community members interacting and helping you - thank you all to Jan, Jon and Volker!), I just updated the Bentley Programming Wiki to provide a new single entry point to learn, explore, and get started with Bentley API and SDK software offerings
    3. Hopefully to get you up and running on the MicroStation CONNECT SDK Update 13, please read and apply a couple recommendations provided and hopefully you can be up and running quickly.
      1. Patch/overlay the MicroStation CONNECT SDK Update 13 make files using: SDKPreviews > mki
      2. Feel free to install (manually for now) some very basic Visual Studio Extensions for VS2017

    HTH,
    Bob



  • Hi Bob
    Your continued work on the SDK and support in getting first timers started is much appreciated.
    Please see reply further down on the configuration issue I was having with the SDK as I am sure other new starters will have the same issue.
    Will go through the recommendations and try out the VS extensions  - glad to see them as well...
    Thank you again.

    Regards

    Stephen

  • Hi Bob,

    I have applied the updated mki files into the SDK unfortunately they have not resolved the issue of shortname path to Visual Studio location.

    And though putting quotes around the definition for SDKVSDIR appears to fix the issue and get me as far as launching the DEVENV and getting into visual studio there still seem to be issues with Building solutions and not seeing everything.

    in the command prompt BUILDALLEXAMPLES having now got into looking at the log files, numerous example builds error with this error such as this example...

    C:\Users\stephen.holmes\AppData\Local\Temp\Bentley\MicroStationSDK\objects\dwgappdata.obj C:\PROGRA~1\Bentley\MicroStationCONNECTSDK\library\bentley.lib C:\PROGRA~1\Bentley\MicroStationCONNECTSDK\library\mdlbltin.lib C:\PROGRA~1\Bentley\MicroStationCONNECTSDK\library\BentleyGeom.lib C:\PROGRA~1\Bentley\MicroStationCONNECTSDK\library\DgnPlatform.lib C:\PROGRA~1\Bentley\MicroStationCONNECTSDK\library\dgnview.lib C:\PROGRA~1\Bentley\MicroStationCONNECTSDK\library\RmgrTools.lib gdi32.lib user32.lib kernel32.lib C:\PROGRA~2\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\lib\x64\msvcrt.lib
    C:\PROGRA~1\Bentley\MicroStationCONNECTSDK\library\mdlbltin.lib
    LINK : fatal error LNK1181: cannot open input file 'C:\PROGRA~2\Microsoft.obj'
    Thu Dec 26 23:25:56 2019, elapsed time: 0:04
    BMAKE: call trace
        line:  414, C:\PROGRA~1\Bentley\MicroStationCONNECTSDK\mki\dlmlink.mki
        line:   82, C:\PROGRA~1\Bentley\MicroStationCONNECTSDK\examples\Annotations\dwgappdata\dwgappdata.mke
    Bentley Systems Make Utility. Version 10.00.00.26, Mar 15 2018
    Thu Dec 26 23:25:56 2019
     

    which makes me think there is still a core configuration problem with paths.

    and Visual Studio fails to compile the MYAPP solution having gone in and set the properties for includes $(sdkinc) and libraries $(sdklib)

    1>------ Build started: Project: MyApp, Configuration: Debug Win32 ------
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(43,5): warning MSB8005: The property 'NMakeBuildCommandLine' doesn't exist.  Skipping...
    1>Done building project "MyApp.vcxproj".
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

    So I am still struggling to get off the ground here with a working environment...
    Thank you all for you patience and suggestions so far...
    If I get this up and running,  then I promise to record a how too video with documented notes for others to get started...
    Regards

    Stephen

  • C:\PROGRA~2\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\lib\x64\msvcrt.lib
    ...
    LINK : fatal error LNK1181: cannot open input file 'C:\PROGRA~2\Microsoft.obj'

    bmake is looking in unquoted folder C:\Progra~2\Microsoft Visual Studio\ ...

    In general, a make file doesn't need a specific directive to the Viz Studio folders.  The C++ compiler and linker look by default in the Viz Studio folders.  For example, a couple of lines above the problem line is this...

    C:\PROGRA~1\Bentley\MicroStationCONNECTSDK\library\RmgrTools.lib gdi32.lib user32.lib kernel32.lib

    The last three libraries are Microsoft Win32 libs.  They are referenced as raw file names without any folder prefix, and the librarian doesn't complain about those (Ask Microsoft why they are called Win32 libs on a 64-bit system).

    I don't understand why bmake has created a fully-qualified path for msvcrt.lib (the C run-time library).  The raw file name would be sufficient.

    Needless to say, I don't have that problem.  However, my development environment has grown over the years.  It has been incrementally modified as new versions of the MicroStation SDK are installed and new versions of Viz Studio are installed.  Clearly, given the problems you see, later versions depend on the successful configuration of earlier versions.  It looks like this is an issue that Bentley Systems should solve when installing the SDK on a computer that has seen neither MicroStation nor Viz Studio previously.

     
    Regards, Jon Summers
    LA Solutions

  • Hi Jon
    Thanks for the direction on the .lib and confirmation, it does indeed look like new installations are missing some inheritance from previous configurations and hitting a problem with paths.
    I will now formally raise a support ticket with Bentley to address this.
    Wishing you all seasons greetings and happy holiday coding.

    Regards

    Stephen

  • Hi Robert

    With the 8.3 Short Names issue addressed all is now working great, have already written my first C# Bentley Apps

    The Visual Studio Extensions for VS2017 are a great help to get you started with the correct configurations and are working well - certainly for C#, have not ventured into C++ yet.

    Are there equivalents for VB.net as well?

    On my wish list would be an online searchable documentation structure for the SDK and API's similar to
    https://docs.microsoft.com/en-us/dotnet/api/system.io.file?view=netframework-4.6.2
    to help navigate the API's.

    I promised I would record some getting started videos for 2020 and will do so in the coming month.
    Would be happy to have them published and critiqued before release.

    Thank you again

    Regards

    Stephen

     

  • With the 8.3 Short Names issue addressed all is now working great, have already written my first C# Bentley Apps

    It's great, congratulations! :-)

    The Visual Studio Extensions for VS2017 are a great help to get you started with the correct configurations and are working well - certainly for C#

    The extensions are great for starting, I agree when they are well designed, they can make a learning process simpler. Nn the other hand you should be aware (it's my long-term experience) that any such automation tool is a good servant, but a bad master, because it hides how things work internally, so when people do not want do next step in learning, they will stay on level "click a button, something will happen magically" ;-)

    But maybe it's the difference between hobby / in-house and professional developers, which are different groups wit very different requirements and needs.

    have not ventured into C++ yet.

    C++ with bmake syntax represents completely different level of complexity.

    Are there equivalents for VB.net as well?

    It does not exist as far as I know. Personally, I see no reason to start any VB.NET development today. It makes life harder, less materials is available and the language itself is quite worse and designed differently than C#.

    On my wish list would be an online searchable documentation structure for the SDK and API's similar to

    Search this forum, it has been discussed many times already.

    Would be happy to have them published and critiqued before release.

    If you look for a feedback (which is very good idea), maybe to share code (if used in the video) before the video will be produced is a good idea. I remember when I did a "training series" long time ago, a ratio between final video and preparation was between 1:10 - 1:50 depending on a discussed topic complexity, so to use correct only inputs makes sense.

    My feeling is that the most of code used in the most of trainings (both examples and videos) does not respect code quality, style, naming and OOP (SOLID...) rules, so people live in the belief such code is recommended one and copy it to own code. From time to time I am in a deep depression when I see some code (not always MicroStation related, and it applies to my own older code also ;-) and I have to evaluate it as "C# language used to create script like code, following C procedural structure, but not OOP in structure where no tests can be used".

    It's a shame when great literature (many books and blogs) about things like SOLID, KISS, testing, naming rules defined for NET etc. are available, plus free analyzers (e.g. Sonary, StyleCop, even basic functionality provided by VS editor) helping to write better and consistent code can be installed and used.

    But it's the topic for separate discussion ;-)

    With regards,
    happy new year and
    happy coding,

      Jan

  • Hi Jan

    Thank you - good advice....
    Absolutely agree anything shown on video should be exemplar...
    My aim of the videos would be just to get as far as opening the example files and runing them in debug mode for that reason...
    And have them critiqued before going live...

    Best Wishes

    Stephen

Reply Children
No Data