U-sql 引用了用 4.5.1 构建的程序集?而需要记录的 4.5

U-sql referenced assembly built with 4.5.1? Whereas documented 4.5 is needed

据记载,U-SQL 使用 .net 4.5

https://docs.microsoft.com/en-us/azure/data-lake-analytics/data-lake-analytics-u-sql-programmability-guide#use-assembly-versioning

因此要确保我们自己的自定义程序集是针对该运行时构建的。

通过 Azure Data Lake 和流分​​析工具版本 2.3.4000.3 创建 "Class Library (For U-SQL Application)" 时,它被设置为构建到 .net 4.5,这很好,但它似乎引用了例如Microsoft.Analytics.Interfaces 构建为 4.5.2 且加载失败。

我正在使用 Visual Studio 15.8.0,感觉就像是因为它来自一个普通的 visual studio 文件夹,它已经升级到你不知情的 sql。

Severity Code Description Project File Line Suppression State Warning The primary reference "Microsoft.Analytics.Interfaces" could not be resolved because it was built against the ".NETFramework,Version=v4.5.2" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". MYUDFNAMEHERE C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild.0\Bin\Microsoft.Common.CurrentVersion.targets 2110

我发现如果删除以下引用:

Microsoft.Analytics.Interfaces Microsoft.Analytics.Interfaces.流媒体 Microsoft.Analytics.Types

然后添加nuget包: Microsoft.Azure.DataLake.USQL.Interfaces v1.1.0

它解决了引用问题。

检查程序集的属性,版本都在 10.2.2.0 上,所以看起来很安全。

但我仍然得到:

Severity Code Description Project File Line Suppression State Warning The primary reference "C:\Users\USERNAME.nuget\packages\microsoft.azure.datalake.usql.interfaces.1.0\lib\net45\Microsoft.Analytics.UnitTest.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.5.2" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". Tt.NetworkAnalytics.ServiceIndex.Usql.Udf C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild.0\Bin\Microsoft.Common.CurrentVersion.targets 2110

但我不担心,因为这个项目不是我的单元测试项目。

将软件包降级到旧版本 1.0.0 Microsoft.Azure.DataLake.USQL.Interface。这帮助我解决了同样的问题。

对我来说最好的解决方案是在文本编辑器中打开项目文件并修改目标框架版本。这对 U-SQL Project 类型和 U-SQL Database Project 类型都有效。

在撰写本文时,我已将 4.5 修改为 4.5.2

我不太清楚为什么微软的 U-SQL 项目模板如此混乱。

随着 VS 更新(15.9.14,2019 年 7 月 9 日),所有 U-SQL 项目和 Analytics dll 将目标框架从 4.5 更改为 4.7,这再次发生.2 但 Azure Data Lake 不支持 4.7.2。或者至少没有它的文档...

所以我们为两个版本创建了自己的 Analytics.dll 以便我们可以在 Azure Data Lake 正式 支持 4.7.2[ 时升级=18=] 及以上。