Languages & Coding > C++ / C#

C# help with a namespace issue

(1/2) > >>

col:
Hiya all,

I'm creating a C# library in a namespace structure set up as


--- Code: ---namespace NamespaceA.NamespaceB
{
public interface IInterface
{
[... some declared methods ...]
}

public class SomeClassBase : IInterface
{
public [... all declared methods of IIinterface are implmeneted...]
}

namespace NamespaceC
{
public class SomeClass : SomeClassBase
{
public [... some more public methods ...]
}
}
}
--- End code ---

In an application that references the library I'm using ( I know I can use 'using' declaratives but this example is for clarity )


--- Code: ---NamespaceA.NamespaceB.IInterface data = new NamespaceA.NamespaceB.NamespaceC.SomeClass();
--- End code ---

but I'm getting 'The type or namespace name 'IInterface' does not exist in the namespace 'NamespaceB'.
There are other classes in the NamespaceB namespace in other files.
Using VStudio 2017Pro, the library and application are building against .Net 4.6.1, both are building for x64, the application has a 'confirmed' reference to the library.

I'm a little lost as too why the error is occuring. I've browsed through SO for over an hour to no avail, so I thought I'd ask here :)

Steve Elliott:

--- Quote ---I'm a little lost

--- End quote ---

So am I looking at that code lol.  Your recent Blitz3D code in another thread was far more readable  :)

Derron:
Instead of browsing "over SO" you might consider asking for help there? Think sooner or later you will get a concise answer.


bye
Ron

col:

--- Quote ---So am I looking at that code lol.  Your recent Blitz3D code in another thread was far more readable  :)
--- End quote ---
Blitz3D is much better of course :)

The issue is this system that I'm working on at work has to expand in the future to be used by other clients. There are many common datas used by all clients and some that won't be. Using interfaces is a good way to 'force' any newer client code to include the 'base' client code instead of me forgetting that the base code exists and rewriting it all in the future.



This error was a red herring - thanks MS  :P

The real issue was the whole build system was screwed up by a typo in a post-build event. I was copying files that are built from different projects in the same solution into a 'release' folder. However the typo: '$(TargetFile)' instead of '$(TargetPath)' in the post-build copy command, didn't cause any errors per-se but caused everything from the 'release' folder to be copied into the local project/x64/release folder so who knows what version the build system was trying to use when it came to building this dll  :)) The build system was moving the wrong files to the wrong places without warning or error.

I corrected the typo and all is good :)

col:

--- Quote ---Instead of browsing "over SO" you might consider asking for help there? Think sooner or later you will get a concise answer.
--- End quote ---
To be honest most of the issues I ever have - someone has had the same and resolved it before me, to the point that if it's not on SO then I have a 'stand-alone' problem... and sure enough the error was as above :)

Navigation

[0] Message Index

[#] Next page

Go to full version