The type or namespace name 'ServiceBus' does not exist in the namespace 'Microsoft'

两盒软妹~` 提交于 2019-12-07 00:33:38

问题


I'm trying to make a C# console app that adds messages to a queue. I'm following the examples about Azure Service Bus given here: http://www.windowsazure.com/en-us/develop/net/how-to-guides/service-bus-queues/

My program does nothing at the moment:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;

namespace testConsole
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }
}

The problem I'm having is that when I add the Microsoft.ServiceBus.dll reference (as explained in the above link, 1-add dll reference and 2-add using statements) I'm getting an error upon compiling: "The type or namespace name 'ServiceBus' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)"

I even looked into the Microsoft.ServiceBus.dll with reflector tool and it does contain Microsoft.ServiceBus namespace. Version number of the dll is 1.6.0.0 and runtime version v4.0.30319.

Any help appreciated.

-pom-


回答1:


A common issue when using Storage and AppFabric services with a non-web applications is that the default Target Framework for Windows Forms app and Console App is .NET Framework 4.0 Client Profile. Change your project's Target Framework to ".NET Framework 4.0" (full) and it will work.



来源:https://stackoverflow.com/questions/8561842/the-type-or-namespace-name-servicebus-does-not-exist-in-the-namespace-microso

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!