The type or namespace name 'IOrchardServices' could not be found

Topics: General
Nov 26, 2011 at 11:52 AM

Hi there, really new to all this.

 

I have the full source.

 

I have created a module via codegen. No problem there but then I added it to the solution.  The icon is different to all the other projects within the Modules directory. Its a standard C# with a page behind it while all the others have the C# logo with a world logo behind it.

As well the project does not recognize interfaces from other projects. I get the following:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

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

Source Error:

 
Line 5:  	public class Migrations : DataMigrationImpl
Line 6:  	{
Line 7:  		private readonly IOrchardServices _orchardServices;
Line 8:  		private readonly IMembershipService _membershipService;
Line 9:  		private readonly IRoleService _roleService;

Kind Regards

 

Simon



Nov 26, 2011 at 3:20 PM

In Visual Studio, if you click on  IOrchardServices and hover over it, you should get a little one-character coloured underline. Hover over that and you'll get an option to automatically add the correct using statement. Since you created the module with codegen, it will have a project reference to the core module, but you also need to specify in each .cs file which namespaces to import.

However, for IRoleService you might need to specifically add a reference to the Orchard.Roles project. You can do this in Solution Explorer by right-clicking on the "References" folder.