<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>[CONNECT U14 C#] MicrostationDeveloperShell.bat returns \Microsoft unexepected at this time.</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time</link><description>Hello All. First post, please be kind! 
 I&amp;#39;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&amp;#39;ve downloaded and installed</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: [CONNECT U14 C#] MicrostationDeveloperShell.bat returns \Microsoft unexepected at this time.</title><link>https://communities.bentley.com/thread/599791?ContentTypeID=1</link><pubDate>Thu, 23 Jul 2020 06:33:31 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:1380bc11-c611-4d85-86fe-e6ae6a359170</guid><dc:creator>Jon Summers</dc:creator><description>[quote userid="1036867" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time/599776"]I was able to fix the references and get the project to build.[/quote]
&lt;p&gt;Excellent!&lt;/p&gt;
&lt;p&gt;Most of the delivered .NET examples have a batch file named &lt;code&gt;openSln.bat&lt;/code&gt;.&amp;nbsp; If you run that from the command shell it will open Viz Studio for you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [CONNECT U14 C#] MicrostationDeveloperShell.bat returns \Microsoft unexepected at this time.</title><link>https://communities.bentley.com/thread/599776?ContentTypeID=1</link><pubDate>Thu, 23 Jul 2020 05:30:50 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:c523e915-cd24-48dd-977d-58dabbd18d72</guid><dc:creator>Luis Fraguada</dc:creator><description>&lt;p&gt;Hello Jan,&lt;/p&gt;
&lt;p&gt;I figured I was complicating the matter! With your suggestions on the MS env variable and the target framework in the csproj file, I was able to fix the references and get the project to build.&lt;/p&gt;
&lt;p&gt;For the original issue with the MicrostationDeveloperShell.bat, I run it from the start menu:&lt;/p&gt;
&lt;p&gt;&lt;span class="mceItem mceNonEditable mceInsertMediaItem mceInsertMediaItem mceInsertMediaItemImage" style="color:transparent;height:240px;width:320px;" id="pastedimage1595481973384v1"&gt;...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;But I&amp;#39;ve also run it from a command prompt, powershell, etc...&lt;/p&gt;
&lt;p&gt;For now I will continue in my safe .net bubble and see how far I get!&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [CONNECT U14 C#] MicrostationDeveloperShell.bat returns \Microsoft unexepected at this time.</title><link>https://communities.bentley.com/thread/599699?ContentTypeID=1</link><pubDate>Wed, 22 Jul 2020 19:36:31 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:5cbe28b4-0b14-4b8d-8d52-5179b1c99b23</guid><dc:creator>Jan Šlegr</dc:creator><description>&lt;p&gt;Hi Luis,&lt;/p&gt;
[quote userid="1036867" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time"]My goal is to write plugins in C# with Visual Studio 2019.[/quote]
&lt;p&gt;Any tool producing valid NET 4.6.2 assembly can be used to create MicroStation C# addins, so VS2019 is fine.&lt;/p&gt;
[quote userid="1036867" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time"]I&amp;#39;ve downloaded and installed Microstation CONNECT 14 and the corresponding SDK.[/quote]
&lt;p&gt;To create &amp;quot;normal&amp;quot; MicroStation C# addins, you do not need SDK at all, because the code is standard NET assembly.&lt;/p&gt;
&lt;p&gt;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).&lt;/p&gt;
[quote userid="1036867" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time"]When I run the MicrostationDeveloperShell.bat from the SDK shortcut [/quote]
&lt;p&gt;Even when it&amp;#39;s probably not the reason of the discussed problem, what is the full command how the shell is started?&lt;/p&gt;
[quote userid="1036867" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time"]I get&amp;nbsp;&lt;code&gt; \Microsoft unexepected at this time:&lt;/code&gt;[/quote]
&lt;p&gt;I agree with Jon there seem to be two problems:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;DOS 8.3 paths are not allowed and it leads to spaces in paths&lt;/li&gt;
&lt;li&gt;Dev tools location is not recognized properly.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In my opinion the latter problem is not important now (before the first one will be solved).&lt;/p&gt;
[quote userid="1036867" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time"]Well, that didn&amp;#39;t work either.[/quote]
&lt;p&gt;All SDK examples are implemented to be built in SDk environment, when the build process is started using bmake and defined by mke file.&lt;/p&gt;
&lt;p&gt;In my opinion it&amp;#39;s easier to simulate SDK environment (because it&amp;#39;s simple for NET examples) and to do only necessary minimum modifications.&lt;/p&gt;
[quote userid="1036867" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time"]corrected the references to point to the right dlls, cleaned, rebuilt. The references still don&amp;#39;t seem to be found.[/quote]
&lt;p&gt;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.&lt;/p&gt;
[quote userid="1036867" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time"]Any advice for a beginner like myself?[/quote]
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;It was discussed several times already in this forum. To .csproj file, to the propery group where &amp;lt;FileAlignment&amp;gt; is defined, add a line:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;&amp;lt;TargetFrameworkVersion&amp;gt;v4.6.2&amp;lt;/TargetFrameworkVersion&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;With regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [CONNECT U14 C#] MicrostationDeveloperShell.bat returns \Microsoft unexepected at this time.</title><link>https://communities.bentley.com/thread/599602?ContentTypeID=1</link><pubDate>Wed, 22 Jul 2020 12:44:31 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:5e3da693-6505-48f5-8a06-37a7bdc53e09</guid><dc:creator>Jon Summers</dc:creator><description>[quote userid="1036867" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time/599592"]&lt;code&gt;SDKVSDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\\&lt;/code&gt; [/quote]
&lt;p&gt;That first entry is a possible culprit.&amp;nbsp; When I open my SDK window, my first relevant entry is this...&lt;/p&gt;
&lt;pre&gt;SDK=G:\PROGRA~1\Bentley\MICROS~2\SDK\&lt;/pre&gt;
&lt;p&gt;The path is modified to DOS-style &lt;a title="Stack Overflow: Get DOS path instead of Windows path" href="https://stackoverflow.com/questions/4051088/get-dos-path-instead-of-windows-path" rel="noopener noreferrer" target="_blank"&gt;short paths&lt;/a&gt;, with a max 8 chars per component.&amp;nbsp; You may be able to modify Windows&amp;#39; behaviour using the &lt;a title="Microsoft: fsutil behavior" href="https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/fsutil-behavior" rel="noopener noreferrer" target="_blank"&gt;fsutil behavior&lt;/a&gt; command.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s some more info &lt;a title="LA Solutions: Visual Studio and MicroStation Development" href="http://www.la-solutions.co.uk/content/CONNECT/MicroStationAPI/VizStudio.htm" rel="noopener noreferrer" target="_blank"&gt;about Windows, Viz Studio and the MicroStation SDK&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [CONNECT U14 C#] MicrostationDeveloperShell.bat returns \Microsoft unexepected at this time.</title><link>https://communities.bentley.com/thread/599592?ContentTypeID=1</link><pubDate>Wed, 22 Jul 2020 11:52:30 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:563d6004-c4c4-46d7-9372-8353ede38471</guid><dc:creator>Luis Fraguada</dc:creator><description>&lt;p&gt;&lt;a href="https://communities.bentley.com/cfs-file/__key/communityserver-discussions-components-files/343173/fraguada.txt"&gt;communities.bentley.com/.../fraguada.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hello Jon,&lt;br /&gt;Thanks for the reply. I found the announcement for the U14 SDK release which revealed I might not have all of the requirements. I installed the missing tools for Visual Studio 2019 but it had no effect on being able to build the sample.&lt;br /&gt;Looking at SET revealed a lot of stuff I&amp;#39;d rather not post, but here are the ONLY entries with quotes, or ones that stood out as interesting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [CONNECT U14 C#] MicrostationDeveloperShell.bat returns \Microsoft unexepected at this time.</title><link>https://communities.bentley.com/thread/599591?ContentTypeID=1</link><pubDate>Wed, 22 Jul 2020 11:06:26 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:2a81e0fb-1f45-4215-baa7-61b876250540</guid><dc:creator>Jon Summers</dc:creator><description>[quote userid="1036867" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time"]My goal is to write plugins in C# with Visual Studio 2019 for CONNECT U14[/quote]
&lt;p&gt;So far, so good!&lt;/p&gt;
[quote userid="1036867" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time"]When I run the MicrostationDeveloperShell.bat from the SDK shortcut [/quote]
&lt;p&gt;I test each release of the SDK, including that for Update 14.&amp;nbsp; It all works out of the box.&lt;/p&gt;
[quote userid="1036867" url="~/products/programming/microstation_programming/f/microstation-programming---forum/200728/connect-u14-c-microstationdevelopershell-bat-returns-microsoft-unexepected-at-this-time"]When I run the MicrostationDeveloperShell.bat from the SDK shortcut I get&amp;nbsp;&lt;code&gt; \Microsoft unexepected at this time:&lt;/code&gt;[/quote]
&lt;p&gt;That looks like there&amp;#39;s a path with spaces somewhere, that should be a quoted &amp;quot;path with spaces&amp;quot;.&lt;/p&gt;
&lt;p&gt;In the SDK shell, type &lt;code&gt;SET SDK&lt;/code&gt; to see the environment and post the resulting &lt;code&gt;FraguadaEnv.txt&lt;/code&gt; here...&lt;/p&gt;
&lt;pre&gt;SET SDK &amp;gt; %TMP%FraguadaEnv.txt&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>