This project is read-only.

Module package not working on dev machine after installing vs 2012

Topics: Customizing Orchard, Installing Orchard, Writing modules
Aug 28, 2012 at 2:02 PM


I have created a module that works fine in the solution where it was created, ie, the orchard source code. I then package it up using package create.

IMPORTANT: the problem appeared IMMEDIATELY after installing visual studio 2012.


If I now install the module on a different app using the package and install from file, all the alerts show the module is installed, it appears in the features list, it is enabled... but there are no menu items, no entry in the migrations table, nothing.

Nothing appears in the logs. The files are, however, installed correctly in the modules folder of the site.


What could be going wrong that stops the module being properly installed using the package given that the module works fine in the source code solution where it was created??

How could installing visual studio 2012 have affected Orchard?

I notice that installing visual studio 2012 resulted in various bits of sql server 2012 being installed at the same time. Could this be relevant? EG, is this why the migrations code never runs?

Aug 28, 2012 at 11:50 PM

Did you try debugging into the module (installed from the package)?

Aug 29, 2012 at 5:48 AM

Isn't VS 2012 installing MVC4 into the GAC? If you're using a version of Orchard earlier than 1.5 then it's not compatible with MVC 4. That could explain it.

Aug 29, 2012 at 8:29 AM
Edited Aug 29, 2012 at 8:51 AM


I have tried using a new install of Orchard 1.5.1, and the problem is the same:

1.  Creating a new module using VS 2012 and Source Code for Orchard 1.5.1 and the module appears correctly when running the orchard site from VS.

2.  Creating a package and then installing that into an Orchard 1.5.1 site, eg, using WebMatrix, running and then installing the package has the following effect:

2.1.  The alerts in the dashboard tell me that the package has installed correctly.  

2.2.  However, enabling the feature does nothing.

2.3.  This is hardly surprising, as installing the package has not even run the migrations.

The last test I can do is to see if the package runs on a web server that doesn't have mvc4 installed.  I will post back once that is done.

However, the main point is that using Orchard 1.5.1 produces the exact same result.  So I think the orchard team need to look at this a bit closer.  Just my opinion.

But if I am right, what will happen when I install mvc 4 on the web server as I will inevitably have to do in order to write other non orchard apps for my clients as I do on a regular basis?

Aug 29, 2012 at 9:09 AM
Edited Aug 29, 2012 at 9:11 AM

OK, I have run more tests.

In an Orchard 1.5.1 app I tried installing other modules from packages created for orchard 1.4.2 and they installed fine.

The difference between the modules is, in my mind, two:

1.  The module that doesn't install from its package has some functionality that uses a controller and a view to produce an email form.  The other modules that install properly don't have this kind of basic controller - view functionality.  However, as the functionality works fine in the Orchard 1.5.1 instance that uses the Source Code (ie, where the module was created), it clearly ISN'T affected by the presence of MVC 4.  What happens is that the package installs the files correctly, but doesn't run the migrations to modify the database.  Ie, it seems to me that the problem is with the migration, that may have nothing to do wtih MVC 4.  As a result, I have copied my migration code below.

2.  The module works fine in Orchard 1.4.2, but I could never get the LocalNav tabs to work with it.  Potentially, there might be a problem with the module.



using System;
using Orchard.ContentManagement.MetaData;
using Orchard.Core.Contents.Extensions;
using Orchard.Data;
using Orchard.Data.Migration;
using Wingspan.CorporateEmails.Models;

namespace Wingspan.CorporateEmails {
    public class Migrations : DataMigrationImpl {
        public int Create() 
            SchemaBuilder.CreateTable("CorporateEmailRecord", table =>
                                                                    .Column("Id", col => col.PrimaryKey().Identity())

            SchemaBuilder.CreateTable("EmailMessageRecord", table =>
                                                                    .Column("Id", col => col.PrimaryKey().Identity())
            return 1;

        public int UpdateFrom1() 
            SchemaBuilder.AlterTable("EmailMessageRecord", table => table.AddColumn("DateSent"));
            return 2;

        public int UpdateFrom2() {
            ContentDefinitionManager.AlterTypeDefinition("CorporateEmailsWidget", cfg => cfg
                .WithSetting("Stereotype", "Widget"));
            return 3;

        public int UpdateFrom3() {
            ContentDefinitionManager.AlterTypeDefinition("CorporateEmailsWidget", cfg => cfg.WithPart("CommonPart"));
            return 4;

The point to note is that the tables do NOT get created, so not even the Create() method is run.

Aug 29, 2012 at 9:46 AM

Please file a bug with your findings.

Aug 29, 2012 at 11:12 AM

I have just uploaded onto a webserver without MVC 4 and Razor 2 or SQL Server 2012 or any other Visual Studio bits and bobs and all works fine.

So no problem with the module code, but defintiely a problem with the environment when VS 2012 is installed.

Aug 29, 2012 at 1:52 PM

Bug filed

Dec 2, 2012 at 8:12 PM

I'm having the exact same issue. You wrote that you have filed a bug, but I was unable to find it, and if the bug was solved.