0
votes

I've been having an adventure with the new u-sql msbuild support, fighting dragons etc in the lands of "preview build".

I realised many of the gotchas were due to discovering inconsistencies between running the build in VS2017 v.s. running msbuild from the command line.

Against my better judgement I added some diagnostic messages by altering the nuget download directly: \packages\Microsoft.Azure.DataLake.USQL.SDK.1.3.1019-preview\build\runtime\USqlSDKBuild.targets

I realise now that USQLSDKPath doesn't override what version is used in visual studio.

And that USQLTargetType* isn't supported within visual studio at the time of writing.

*USQLTargetType is needed if you want to compile scripts without checking for pre-existing schema objects, to avoid a chicken and egg scenario.

The versions I've found on my machine are:

  1. C:\Users[user name]\AppData\Roaming\Microsoft\DataLake\MsBuild\1.0\
  2. C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\ADL Tools\2.3.3000.5\
  3. And the one installed via nuget relative to my sln.

Can I assume the first in AppData is installed as part of the Visual Studio installation and the second is the visual studio extension from the marketplace?

I've been battling for a few days on various elements so wondered how far others have got in this direction? I also realise this is in preview mode, so has rough edges.

Am I safe to alter:

  <Import Project="UsqlSDKBuild.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true' And  Exists('UsqlSDKBuild.targets')" />
  <Import Project="$(USQLSDKPath)\UsqlSDKBuild.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true' And !Exists('UsqlSDKBuild.targets') And '$(USQLSDKPath)' != '' And Exists('$(USQLSDKPath)\UsqlSDKBuild.targets')" />
  <!-- backward compatible with IDE build -->
  <Import Project="$(AppData)\Microsoft\DataLake\MsBuild\1.0\Usql.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true'" />

To force using a later version in the IDE as well?

1

1 Answers

0
votes

Forcing Visual Studio to use the nuget downloaded USQL SDK doesn't seem viable at the moment.

Even if I deleted all statements at the bottom of the usqlproject and tweaked USqlSDKBuild.targets to allow the project to be loaded without error (I had problems with the UsingTask)....

I discovered that Visual Studio was overriding the USQLSDKPath back to:

USQLSDKPath='C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\ADL Tools\2.3.3000.5\U-SQLSDK'

Meaning I'm unable to use the nuget version reliably.

In that same directory I did notice "USqlDBProject.targets" (what sounds like the new upcoming project type) and that USqlSDKBuild.targets has more options. Both indicating that the nuget package is infact older than the extension's SDK.

I'm considering that infact the one bundled with the Visual Studio extension is infact newer than the nuget version!


EDIT

After semi concluding there are different versions at play, I went back to basics and - doh - realised that the nuget package is out of date!

I made this mistake because the u-sql project doesn't support the nuget in Visual Studio so I needed to add it by hand to the packages.config, hardcoding it to "Microsoft.Azure.DataLake.USQL.SDK.1.3.1019-preview" as mentioned in https://blogs.msdn.microsoft.com/azuredatalake/2017/10/24/continuous-integration-made-easy-with-msbuild-support-for-u-sql-preview/

I wrongly assumed the the blog post was up to date, due to it being linked to within the relatively recently promoted spring 2018 release notes. But double checking the blog post obviously pre-dates the release notes. My bad for coding tired.