1

In my Helix based solution, every time I publish a change to a feature project and load the site I get this error below.

The error goes away when I publish the website project in the project layer. So every time I publish a feature project in my development box I'm having to republish the website project as well.

Any ideas on how to troubleshoot this? I can't find "using code" anywhere in my solution.

enter image description here

5
  • Right click > Find Reference. You tell us where it is.
    – Chris Auer
    May 27 '18 at 16:41
  • What do you mean; "where is it defined?" It's defined right there. It's your code.
    – Mark Cassidy
    May 27 '18 at 18:20
  • There is no reference to "using code" anywhere in my solution. Seems to be something that ASP.Net generates when it is compiling my default layout View file? I can only see it in the Temporary ASP.NET Files folder
    – Vivek Ayer
    May 27 '18 at 18:38
  • OK, I think Visual Studio is holding on to a reference somewhere.Since I create all my projects calling it "code" to create the code folder following Helix conventions and then rename it to the actual project. But as far as I can tell I changed all references to "code" and as mentioned it works when I just recompile the project again. Very Odd
    – Vivek Ayer
    May 27 '18 at 18:47
  • 1
    No, it definitely isn't Visual Studio holding a reference. I'm pretty sure it's because you trigger a recompilation of the views when you publish the feature - these are by default not precompiled.
    – Mark Cassidy
    May 28 '18 at 9:21
1

I've resolved the issue. I was looking for "using code" in my solution and wondering where that reference came from, but what I should have been looking for is

<add namespace="code" />

I found this in the Views folder web.config of all of my Feature projects. Since I was creating all my projects using the name "code" to follow the Helix module structure and then renaming them to the actual name I want, Visual Studio was adding that as a default namespace in the Views web.config folder.

/…
    /[Module Name]
        /code
            /Views/web.config

Hope someone finds this useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.