Last post Jul 01, 2019 06:37 AM by Xing Zou
Jun 29, 2019 10:21 AM|afrika|LINK
I am playing around VS2019 community Preview version and was creating my models. Instead of putting my models in the default model folder, I put them in a folder called X_Models and getting this error. I then removed the Underscore and still get the same
error, I have closed and restarted VS and it wont build.
I have now excluded the folder and copied the classes and datacontext file into the original models folder and it works
Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'XModels' could not be found (are you missing a using directive or an assembly reference?) 1 Active
Jun 29, 2019 12:16 PM|mgebhard|LINK
Jun 29, 2019 02:51 PM|DA924|LINK
If you create a project folder and add classes to the folder, that's called namespace seperation. You would need to use a 'using'-statment in a class that points to the namespace that the folder created yhat the classes are under in order to access a class
in the folder.
using X_Model; // It would need to be put at the top of the class that needed access to any class in the X_Model folder under the namespace.
Jul 01, 2019 06:37 AM|Xing Zou|LINK
First of all,check you namespace of model, for example:
public class TestModel
Then,you could either specify the full name with namespace @model MyProject.XModels.TestModelor add @using MyProject.XModels in class.
You could post some related code where this error occurs if you still have problems.