[CONNECT U14 C#] MicrostationDeveloperShell.bat returns \Microsoft unexepected at this time.

Hello All. First post, please be kind!

I'm just getting started with writing plugins for MicroStation, though I typically work on writing plugins for Rhino 3D. My goal is to write plugins in C# with Visual Studio 2019. I've downloaded and installed Microstation CONNECT 14 and the corresponding SDK. When I run the MicrostationDeveloperShell.bat from the SDK shortcut I get  \Microsoft unexepected at this time:

So I thought, ok, I'll just dig into the samples, open one up, and build it myself. Well, that didn't work either. I opened up MicroStationCONNECTSDK\examples\Elements\ManagedToolsExample, corrected the references to point to the right dlls, cleaned, rebuilt. The references still don't seem to be found.

Any advice for a beginner like myself?

Thanks in advanced and apologies for any obvious things I am overlooking on my part!

Parents
  • Hi Luis,

    My goal is to write plugins in C# with Visual Studio 2019.

    Any tool producing valid NET 4.6.2 assembly can be used to create MicroStation C# addins, so VS2019 is fine.

    I've downloaded and installed Microstation CONNECT 14 and the corresponding SDK.

    To create "normal" MicroStation C# addins, you do not need SDK at all, because the code is standard NET assembly.

    The advantage of SDK is documentation of API plus some tools required for advanced topics (e.g. to compile ribbon definition to rsc and to integrate it with NET and native code).

    When I run the MicrostationDeveloperShell.bat from the SDK shortcut

    Even when it's probably not the reason of the discussed problem, what is the full command how the shell is started?

    I get  \Microsoft unexepected at this time:

    I agree with Jon there seem to be two problems:

    • DOS 8.3 paths are not allowed and it leads to spaces in paths
    • Dev tools location is not recognized properly.

    In my opinion the latter problem is not important now (before the first one will be solved).

    Well, that didn't work either.

    All SDK examples are implemented to be built in SDk environment, when the build process is started using bmake and defined by mke file.

    In my opinion it's easier to simulate SDK environment (because it's simple for NET examples) and to do only necessary minimum modifications.

    corrected the references to point to the right dlls, cleaned, rebuilt. The references still don't seem to be found.

    Do not change how references are defined. To use $(MS) variable to point to MicroStation installation is convenient and flexible way. To use absolute path, as used by default by Visual Studio, is a wrong way.

    Any advice for a beginner like myself?

    Add MS variable and points it to a folder where microstation.exe is installed (including path ending slash) and the assemblies will be found without modifying plenty of lines in csproj file.

    But there is one modification you have to do in SDK NET examples: Target NET framework definition is missing in .csproj file, because defined externally when the example is compiled using bmake.

    It was discussed several times already in this forum. To .csproj file, to the propery group where <FileAlignment> is defined, add a line:

    <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>

    Also, be aware SDK examples are configured to use mdlapps folder as output, which requires to start Visual Studio as administrator to allow to copy results to this folder. Alternatively you can change access rights of mdlapps folder or to use another (not so restricted) folder. But in such case, you have to modify MS_ADDINPATH accordingly.

    With regards,

      Jan

    Answer Verified By: Luis Fraguada 

Reply
  • Hi Luis,

    My goal is to write plugins in C# with Visual Studio 2019.

    Any tool producing valid NET 4.6.2 assembly can be used to create MicroStation C# addins, so VS2019 is fine.

    I've downloaded and installed Microstation CONNECT 14 and the corresponding SDK.

    To create "normal" MicroStation C# addins, you do not need SDK at all, because the code is standard NET assembly.

    The advantage of SDK is documentation of API plus some tools required for advanced topics (e.g. to compile ribbon definition to rsc and to integrate it with NET and native code).

    When I run the MicrostationDeveloperShell.bat from the SDK shortcut

    Even when it's probably not the reason of the discussed problem, what is the full command how the shell is started?

    I get  \Microsoft unexepected at this time:

    I agree with Jon there seem to be two problems:

    • DOS 8.3 paths are not allowed and it leads to spaces in paths
    • Dev tools location is not recognized properly.

    In my opinion the latter problem is not important now (before the first one will be solved).

    Well, that didn't work either.

    All SDK examples are implemented to be built in SDk environment, when the build process is started using bmake and defined by mke file.

    In my opinion it's easier to simulate SDK environment (because it's simple for NET examples) and to do only necessary minimum modifications.

    corrected the references to point to the right dlls, cleaned, rebuilt. The references still don't seem to be found.

    Do not change how references are defined. To use $(MS) variable to point to MicroStation installation is convenient and flexible way. To use absolute path, as used by default by Visual Studio, is a wrong way.

    Any advice for a beginner like myself?

    Add MS variable and points it to a folder where microstation.exe is installed (including path ending slash) and the assemblies will be found without modifying plenty of lines in csproj file.

    But there is one modification you have to do in SDK NET examples: Target NET framework definition is missing in .csproj file, because defined externally when the example is compiled using bmake.

    It was discussed several times already in this forum. To .csproj file, to the propery group where <FileAlignment> is defined, add a line:

    <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>

    Also, be aware SDK examples are configured to use mdlapps folder as output, which requires to start Visual Studio as administrator to allow to copy results to this folder. Alternatively you can change access rights of mdlapps folder or to use another (not so restricted) folder. But in such case, you have to modify MS_ADDINPATH accordingly.

    With regards,

      Jan

    Answer Verified By: Luis Fraguada 

Children