3

I'm following the instructions on this link https://blogs.msdn.microsoft.com/azuredatalake/2017/10/24/continuous-integration-made-easy-with-msbuild-support-for-u-sql-preview/

It states that

After running MSBuild from command line or as a VSTS task, all scripts in the U-SQL project are built and output to a single file at "Build output path/script name/script name.usql". You can copy this composite U-SQL script to the release folder for further deployment.

Within my Visual Studio project (.usqlproj) I have multiple .usql scripts

  • CreateDatabase.usql
  • CreateTable.usql
  • CreateTvf.usql

when I do clean and msbuild and then check bin\debug folder, all I get is just CreateDatabase.usql and within that there is only CREATE DATBASE statement. As per the blog I would have thought all the 3 usql scripts would have merged into 1 composite usql script. The msbuild command I executed from command prompt on my machine

msbuild TheProject\TheProject.usqlproj /t:Clean /t:Rebuild /property:USQLSDKPath=C:\TheProject\src\packages\Microsoft.Azure.DataLake.USQL.SDK.1.3.1019-preview\build\runtime,USQLTargetType=Merge

I'm using Visual Studio 2017 15.4.3 and Azure Data Lake tools 2.3.0000.1

What am I doing wrong?

databash
  • 656
  • 6
  • 19

2 Answers2

1

Due to some legacy reasons, to make sure all files in the usqlproj are built, the condition are defined in USqlSDKBuild.targets as below <ItemGroup> <FileToBuild Condition="'$(JustOneFile)' == '' and '$(Build_all_files_in_this_project)' != 'true'" Include="$(ActiveFile)" /> <FileToBuild Condition="'$(JustOneFile)' != '' " Include="$(JustOneFile)" /> <FileToBuild Condition="'$(Build_all_files_in_this_project)' == 'true'" Include="Build_all_files_in_this_project" /> </ItemGroup>

For current preview release, please add "/property:Build_all_files_in_this_project=true,JustOneFile=''" to the command line to make sure all scripts are built. We will update this in later releases with a easier and simpler condition.

Yu Dong Yang
  • 236
  • 1
  • 5
0

The command msbuild TheProject\TheProject.usqlproj /t:Clean /t:Rebuild /property:USQLSDKPath=C:\TheProject\src\packages\Microsoft.Azure.DataLake.USQL.SDK.1.3.1019-preview\build\runtime,USQLTargetType=Merge actually build the script you selected.

If you are selecting CreateDatabase.usql in VS, it will build the script CreateDatabase.usql in command line.

As below example, since it's selecting test.usql, when execute msbuild command, it will only build test.usql. As the way clicking Build button for the USQL project.

enter image description here

If you want to build all the scripts under the USQL project, you should select Build All Scripts button in VS.

enter image description here

enter image description here

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • 1) Yes, right click Build All Scripts will Build_all_files_in_this_project. How do we get the same behaviour in **msbuild command line**? 2) That's still not producing **a single composite U-SQL script** - which I can use in release and further deployment - as mentioned in the blog. It is actually producing 3 different .usql scripts in bin\Debug folder. Or did I misunderstood the blog? – databash Nov 14 '17 at 10:17
  • The article also says "output to **a single file** at "Build output path/script name/script name.usql"". In order to understanding it correctly, I added a comment under the article, you can follow up. – Marina Liu Nov 17 '17 at 06:10
  • 2
    There seems to be a misunderstanding of "Merge" target here. The "Merge" target is not to merge all U-SQL scripts in current directory into a single larger script. Instead, it is to "compiles code-behind files, like .cs, and inlines the resulting user defined code library into the U-SQL script." So, if you have 3 U-SQL scripts in project, the merged compile result will be 3 different files in 3 target folders. – Yu Dong Yang Nov 20 '17 at 02:55