user1481183
user1481183

Reputation: 368

c# - vcvars32 errors out trying to compile class into dll

I'm trying to compile a c# class (myClass, which implements ImyInterface) into a dll using vcvars32.

I get error CS0246: The type or namespace name 'ImyInterface' could not be found (are you missing a using directive or an assembly reference?).

Has anybody ran into this problem?

Upvotes: 1

Views: 100

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1503140

Note: it's not vcvars32 which is failing here; it's the C# compiler which is giving an error. You may have run vcvars32 in order to set up your environment, but that's very different.

Has anybody ran into this problem?

Only when trying to refer to a type that the C# compiler doesn't know about. As the error message says, check your using directives (to make sure you're importing all the namespaces you need) and your assembly references (to make sure you have a reference to the assembly containing ImyInterface).

Also check your spelling - ImyInterface would usually be IMyInterface, and C# is case-sensitive.

If ImyInterface doesn't exist within an existing library which you're referencing - in other words, if you're trying to build that interface into the same assembly - then you'll need to include the source file containing the interface declaration on the command line.

That's about all we can say with no further information about where the interface is, what namespace it's in, what namespace your class is in, etc.

Upvotes: 1

Related Questions