Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Vanilson 7 posts 97 karma points
    Apr 07, 2018 @ 07:39
    Vanilson
    0

    Missing using directive or assembly reference (FormDataCollection)

    Hi devs,

    For some reason I had to rename my project that was working fine, I rename the solution, projects and namespaces. But, after renaming I get the following error: enter image description here

    Code

    [PluginController("Custom")]
    [Tree("Custom", "CustomTree", "Custom Section", iconClosed: "icon-doc")]
    public class CustomSectionTreeController: TreeController
    {
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            var nodes = new TreeNodeCollection();
            var item = this.CreateTreeNode("dashboard", id, queryStrings, "Custom Section", "icon-alert", false);
            nodes.Add(item);
            return nodes;
        }
    
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            return null;
        }
    }
    

    The error says that it´s missing using directive or assembly reference for FormDataCollection. I checked the references in my project and the reference(System.Net.Http.Formatting) for FormDataCollection is there.

    Anyone knows how to solve this problem?

    Note: I'm using Umbraco 7.2.1

    Best Regards

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    Apr 07, 2018 @ 08:41
    Søren Gregersen
    0

    If you open the references-folder in the project with the controller, you should see a broken reference - or maybe just a missing using-statement in the controller code?

    Most likely the reference was made to a path that has now changed after you renamed the project. The reference may have been point at an assembly in the projects bin folder - that's a bad practice, but it occurs way to often.

  • Vanilson 7 posts 97 karma points
    Apr 07, 2018 @ 08:58
    Vanilson
    0

    Hi Gregersen,

    If you open the references-folder in the project with the controller, you should see a broken reference - or maybe just a missing using-statement in the controller code?

    With the controller and the the references folder everything is normal.

    Best Regards

  • Vanilson 7 posts 97 karma points
    Apr 07, 2018 @ 13:02
    Vanilson
    100

    Hi Devs,

    Problem solved, Visual Studio was showing that the assemblie System.Net.Http.Formatting was included in my project but when I checked the bin folder the assemblie wasn't there.

    All I did was copy the assemblie from the project that was working fine and paste it into the bin folder of the new project.

    Best Regards

Please Sign in or register to post replies

Write your reply to:

Draft