在Azure Function App中编译C#函数时的命名空间错误 [英] Namespace errors when compiling C# Function in Azure Function App

查看:59
本文介绍了在Azure Function App中编译C#函数时的命名空间错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试保存我的函数时出现以下错误。我在这里关注指南:  https://www.taygan.co/blog/2018/05/14/embedded-analytics-with-power-bi



2018-12-04T19:37:04 欢迎您,您现在已连接到日志流服务。

2018-12-04T19:37:17.956 [信息]功能'getEmbedToken'的脚本已更改。重新加载。

2018-12-04T19:37:18.115 [错误] run.csx(1,1):错误CS0006:找不到元数据文件'System.Web.Extensions'

2018-12-04T19:37:18.284 [错误] run.csx(5,18):错误CS0234:名称空间'System.Web'中不存在类型或命名空间名称'Script'(是你错过了一个程序集引用?)

2018-12-04T19:37:18.336 [错误] run.csx(6,17):错误CS0234:类型或命名空间名称'IdentityModel'不存在在命名空间'Microsoft'中(你错过了程序集引用?)

2018-12-04T19:37:18.397 [错误] run.csx(7,17):错误CS0234:类型或命名空间名称'PowerBI'在名称空间'Microsoft'中不存在(您是否缺少程序集引用?)

2018-12-04T19:37:18.455 [错误] run.csx(8,17 ):错误CS0234:命名空间"Microsoft"中不存在类型或命名空间名称"PowerBI"(您是否缺少程序集引用?)

2018-12-04T19:37:18.507 [错误] run.cs x(9,17):错误CS0234:名称空间"Microsoft"中不存在类型或命名空间名称"Rest"(您是否缺少程序集引用?)

2018-12-04T19: 37:18.535 [警告] run.csx(21,75):警告CS0618:'TraceWriter'已过时:'将在即将推出的版本中删除。请改用Microsoft.Extensions.Logging.ILogger。'
$
2018-12-04T19:37:18.557 [错误] run.csx(25,26):错误CS0246:类型或命名空间名称'UserPasswordCredential '找不到(你错过了使用指令或汇编引用吗?)

2018-12-04T19:37:18.608 [错误] run.csx(26,37):错误CS0246:找不到类型或命名空间名称'AuthenticationContext'(您是否缺少using指令或程序集引用?)

2018-12-04T19:37:18.675 [错误] run.csx(29 ,32):错误CS0246:找不到类型或命名空间名称'TokenCredentials'(您是否缺少using指令或程序集引用?)

2018-12-04T19:37:18.816 [错误] run.csx(31,29):错误CS0246:找不到类型或命名空间名称'PowerBIClient'(您是否缺少using指令或程序集引用?)

2018-12 -04T19:37:18.867 [错误] run.csx(34,9):错误CS0246:类型或命名空间名称'Report'不能是fou nd(您是否缺少using指令或程序集引用?)

2018-12-04T19:37:18.915 [错误] run.csx(38,50):错误CS0246:类型或命名空间找不到名称'GenerateTokenRequest'(您是否缺少using指令或汇编引用?)

2018-12-04T19:37:18.964 [错误] run.csx(39,9):错误CS0246:找不到类型或命名空间名称'EmbedToken'(您是否缺少using指令或程序集引用?)

2018-12-04T19:37:19.025 [错误]运行。 csx(46,9):错误CS0246:找不到类型或命名空间名称'JavaScriptSerializer'(您是否缺少using指令或程序集引用?)

2018-12-04T19:37 :19.087 [错误] run.csx(46,39):错误CS0246:找不到类型或命名空间名称'JavaScriptSerializer'(您是否缺少using指令或程序集引用?)

2018-12-04T19:37:19.253 [信息]编译失败。

解决方案

看起来像 https://www.taygan.co / blog / 2018/05/14 / embedded-analytics-with-power-bi  使用
a V1函数。目前默认使用运行时V2创建一个新函数(基于netcore框架)。


尝试创建V1函数:


1.创建一个新函数。


2.在门户网站点击功能 - >概述 - >功能应用设置 - >运行时版本。将其更改为~1。


-Alexey




I get the following errors when I try to save my Function. I am following the guide here: https://www.taygan.co/blog/2018/05/14/embedded-analytics-with-power-bi

2018-12-04T19:37:04  Welcome, you are now connected to log-streaming service.
2018-12-04T19:37:17.956 [Information] Script for function 'getEmbedToken' changed. Reloading.
2018-12-04T19:37:18.115 [Error] run.csx(1,1): error CS0006: Metadata file 'System.Web.Extensions' could not be found
2018-12-04T19:37:18.284 [Error] run.csx(5,18): error CS0234: The type or namespace name 'Script' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
2018-12-04T19:37:18.336 [Error] run.csx(6,17): error CS0234: The type or namespace name 'IdentityModel' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
2018-12-04T19:37:18.397 [Error] run.csx(7,17): error CS0234: The type or namespace name 'PowerBI' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
2018-12-04T19:37:18.455 [Error] run.csx(8,17): error CS0234: The type or namespace name 'PowerBI' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
2018-12-04T19:37:18.507 [Error] run.csx(9,17): error CS0234: The type or namespace name 'Rest' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
2018-12-04T19:37:18.535 [Warning] run.csx(21,75): warning CS0618: 'TraceWriter' is obsolete: 'Will be removed in an upcoming version. Use Microsoft.Extensions.Logging.ILogger instead.'
2018-12-04T19:37:18.557 [Error] run.csx(25,26): error CS0246: The type or namespace name 'UserPasswordCredential' could not be found (are you missing a using directive or an assembly reference?)
2018-12-04T19:37:18.608 [Error] run.csx(26,37): error CS0246: The type or namespace name 'AuthenticationContext' could not be found (are you missing a using directive or an assembly reference?)
2018-12-04T19:37:18.675 [Error] run.csx(29,32): error CS0246: The type or namespace name 'TokenCredentials' could not be found (are you missing a using directive or an assembly reference?)
2018-12-04T19:37:18.816 [Error] run.csx(31,29): error CS0246: The type or namespace name 'PowerBIClient' could not be found (are you missing a using directive or an assembly reference?)
2018-12-04T19:37:18.867 [Error] run.csx(34,9): error CS0246: The type or namespace name 'Report' could not be found (are you missing a using directive or an assembly reference?)
2018-12-04T19:37:18.915 [Error] run.csx(38,50): error CS0246: The type or namespace name 'GenerateTokenRequest' could not be found (are you missing a using directive or an assembly reference?)
2018-12-04T19:37:18.964 [Error] run.csx(39,9): error CS0246: The type or namespace name 'EmbedToken' could not be found (are you missing a using directive or an assembly reference?)
2018-12-04T19:37:19.025 [Error] run.csx(46,9): error CS0246: The type or namespace name 'JavaScriptSerializer' could not be found (are you missing a using directive or an assembly reference?)
2018-12-04T19:37:19.087 [Error] run.csx(46,39): error CS0246: The type or namespace name 'JavaScriptSerializer' could not be found (are you missing a using directive or an assembly reference?)
2018-12-04T19:37:19.253 [Information] Compilation failed.

解决方案

It looks like https://www.taygan.co/blog/2018/05/14/embedded-analytics-with-power-bi using a V1 function. Currently a new function is created with runtime V2 by default (based on netcore framework).

Try to create V1 function:

1. Create new a function.

2. In portal click on function -> Overview -> Function app settings -> Runtime version. Change it to ~1.

-Alexey



这篇关于在Azure Function App中编译C#函数时的命名空间错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆