Robmaister / SharpFont

Cross-platform FreeType bindings for .NET - Need maintainer
Other
286 stars 104 forks source link

The type or namespace name 'SharpFont' could not be found. "using SharpFont;" isn't working. #141

Closed futuremotiondev closed 4 months ago

futuremotiondev commented 6 months ago

I am fairly new to C# and I'm trying to get a simple console app set up to use SharpFont. I installed the NuGet packages SharpFont 4.0.1 and SharpFont.Dependencies 2.6.0:

devenv_XZL355RPZg

But when I add using SharpFont;, I get:

Error CS0246 The type or namespace name 'SharpFont' could not be found (are you missing a using directive or an assembly reference?)

Here's a screenshot:

devenv_GLm0VXz4xK

What am I doing wrong? Why isn't the using statement resolving?

If anyone more experienced can help, it would be greatly appreciated.

HinTak commented 6 months ago

It is as 2nd half of the message says . You are missing an assembly reference. Something like this in your csproj: https://github.com/HinTak/Font-Validator/blob/aa6d6bc0f1b5eb257877a998f97dbb323f7ddabb/Compat/Compat.csproj#L32

This is really basic c# knowledge at the entry level, and better suited for stackoverflow, for example... nothing to do with sharpfont.

lr-devx commented 4 months ago

It is as 2nd half of the message says . You are missing an assembly reference. Something like this in your csproj: https://github.com/HinTak/Font-Validator/blob/aa6d6bc0f1b5eb257877a998f97dbb323f7ddabb/Compat/Compat.csproj#L32

This is really basic c# knowledge at the entry level, and better suited for stackoverflow, for example... nothing to do with sharpfont.

Your comment is irrelevant as the OP installed the library from NuGet. The project that you linked adds the reference manually without using NuGet at all. When using NuGet, the reference to the installed package should be added automatically.

HinTak commented 4 months ago

@lr-devx unless night actually modifies and updates the cproj, I can't see how your comment is relevant...

lr-devx commented 4 months ago

@fmotion1 To address your issue, it seems that this happens with SharpFont 3.0.0 and later. When using V2.5.3, I do have the namespace available. This works for the time being until it gets fixed (if it will ever) or just add the reference manually as @HinTak said.

lr-devx commented 4 months ago

@lr-devx unless night actually modifies and updates the cproj, I can't see how your comment is relevant...

I'm pointing out that your answer doesn't (or partially) resolve the issue as installing the package from NuGet should work as much as adding the library manually. That much hustle is unnecessary.

HinTak commented 4 months ago

My main point is that the CS0246 error and addressing messages about missing reference, is quite generic c# knowledge/experience, and not specific to sharpfont. There are probably dozens of discussions on stackoverflow, and more appropriate there. Unless you are suggesting that sharpfont is mis-packaged for nuget.

futuremotiondev commented 4 months ago

I apologize for placing this issue in the wrong forum. I am indeed new to C#, but trying to learn as much as I can every day. I appreciate the comments from everyone here despite the fact that my question is probably a bit too basic to be raised here.

I always was under the impression that if I install the NuGet package, the dependencies get installed along with that installation as @lr-devx said.

I'll make the change to my csproj file and move forward.

Thanks all.