问题描述
我有一个带有以下代码的函数(即,仅引用ServiceBus)
I have a function with following code, (ie, just referencing ServiceBus)
#r "Microsoft.ServiceBus"
using System;
public static void Run(TimerInfo myTimer, TraceWriter log)
{
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
}
保存时会出现编译错误:
2017-08-10T08:53:21 欢迎您,您现在已连接到日志流服务.
2017-08-10T08:53:57.076函数'TimerTriggerCSharpTest'的脚本已更改.
2017-08-10T08:53:57.076 Script for function 'TimerTriggerCSharpTest' changed.
正在重新加载.
2017-08-10T08:53:57.076函数'TimerTriggerCSharpTest'的脚本已更改.正在重新加载.
2017-08-10T08:53:57.185 run.csx(1,1):错误CS0006:找不到元数据文件'Microsoft.ServiceBus'
2017-08-10T08:53:57.185编译失败.
2017-08-10T08:53:57.185编译失败.
2017-08-10T08:53:57.904函数已启动(Id = 2fb86a88-8be0-4ae6-b55c-3c8de1713651)
2017-08-10T08:53:58.018函数编译错误
2017-08-10T08:53:58.018函数编译错误
2017-08-10T08:53:58.018 run.csx(1,1):错误CS0006:找不到元数据文件'Microsoft.ServiceBus'
2017-08-10T08:53:58.044执行功能时发生异常:Functions.TimerTriggerCSharpTest. Microsoft.Azure.WebJobs.Script:脚本编译失败.
2017-08-10T08:53:58.060函数已完成(失败,Id = 2fb86a88-8be0-4ae6-b55c-3c8de1713651,持续时间= 154ms)
2017-08-10T08:55:21 在过去1分钟内没有新的跟踪记录.
推荐答案
尝试在发生此编译错误的函数的视图文件中添加project.json文件.您可以使用类似下面的内容.
Try adding project.json file in the view files of the function where this compilation error occurred. You may use something like below.
{
"frameworks": {
"net46":{
"dependencies": {
"WindowsAzure.ServiceBus": "4.0.0"
}
}
}
}
欢呼
K
这篇关于引用Microsoft.ServiceBus的编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!