I have seen cases where the error message is comletely irrelevant to the
actual error, as well as cases where it just simply says build failed with
no
error messages or warnings at all (turned out it didn't like two vs
instances
with a database project in each solution). It is apparantly unable to
understand Utilities, but the reason may not be so obvious. As you have
put
it as a using directive the most likely cause would be that you are not
referencing the project/assembly containing the
DotNetNuke.Common.Utilities
classes.
In your code, if you have at least one class with the namespace
DotNetNuke.Common.Utilities in a referenced project the code should
compile.
There may be an error if you at the same time have a Utilities class in
DotNetNuke.Common but the error message should in that case indicate that
Utilities already exists.
I assume you do have a class with this namespace, so there may well be a
bug. Try removing the using directive referring to Utilities and instead
use
the full class name for BannerInfo and/or DataProvider. If this works,
try
deleting the namespace part from BannerInfo/DataProvider and see if Visual
Studio is able to figure out where these classes are defineed (ALT+F10
when
the cursor is on the class name).
As for using directives inside or outside the namespace. I don't think it
matters at all as long as they are outside the class scope.
If you are able to reproduce the error in a new solution you can submit a
bug report at the Microsoft Developer Division Feedback Center
https://connect.microsoft.com/VisualStudio
(You may need to sign in to be able to submit a bug)
If you rather want me to submit the bug, send me a project where this bug
is
reproducable and I'll be happy to submit a bug report.
--
Happy Coding!
Morten Wennevik [C# MVP]
mathphoenix said:
some more detail, I have use c# for many yeas, I understand the concept,
I
think it may be bug of visual studio 2008?
I am doing some refractor of dotnetnuke(the edition 4.09) for my own
purpose.
one file which can pass check before like this:
namespace DotNetNuke.Services.Vendors
{
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Data;
using System;
using System.Collections;
using System.Runtime.CompilerServices;
public class BannerController
{
public void AddBanner(BannerInfo objBannerInfo)
{
DataProvider.Instance().AddBanner(objBannerInfo.BannerName,
objBannerInfo.VendorId, objBannerInfo.ImageFile, objBannerInfo.URL,
objBannerInfo.Impressions, objBannerInfo.CPM, objBannerInfo.StartDate,
objBannerInfo.EndDate, objBannerInfo.CreatedByUser,
objBannerInfo.BannerTypeId, objBannerInfo.Description,
objBannerInfo.GroupName, objBannerInfo.Criteria, objBannerInfo.Width,
objBannerInfo.Height);
}
.....
}
}
Now, i was told that error CS0234: “Utilities†is not exists in
namespace
“DotNetNuke.DotNetNuke.Commonâ€(miss some reference?) ,
In my opinion, no matter which file I add to this project, the error is
misleading, and should be a bug, or it's my fault?
The project's default namespace is DotNetNuke, and I think it's nothing
about the using directive , isn't it?