Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity 3.x: Developing with Sitefinity > c# and vb.net in App_code

c# and vb.net in App_code

  • Rabindra Intermediate avatar

    Posted on Mar 12, 2010 (permalink)

    Hi,
    I wanted to have both c# and vb.net code in App_code so I created 2 folders CSCode and VBCode. I already had few cs class files in App_code so I moved them to CSCode folder.
    In web.config file I changed
    <add name="Sorted List" section="Custom controls" type="CustomLists, App_Code" description="Sorted List"/>
    to
    <add name="Sorted List" section="Custom controls" type="CustomLists, App_SubCode_CSCode" description="Sorted List"/>

    I don't get error while compiling but when I view my custom control I get this error.
    Could not find a type for a name. The type name was 'CustomLists, App_Code.sykwvap6, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

    Any suggestions?

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Mar 14, 2010 (permalink)

    Hello Rabindra,

    The compilation folder remains App_Code no matter that you have placed the code in a sub folder of App_Code. So, the type should remain type="CustomLists, App_Code". The error you are getting is because the application cannot find dll called App_SubCode_CSCod and namespace CustomLists

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

    Reply

  • Rabindra Intermediate avatar

    Posted on Mar 14, 2010 (permalink)

    Hi Ivan,
    Ok, I changed App_SubCode_CSCode back to App_code and compiles with no errors. But when I view the page I still get the same error. And if I move the class file to App_Code/Sortedlists.cs I don't get the error.
    Does this work at your test environment?

    Reply

  • Rabindra Intermediate avatar

    Posted on Mar 15, 2010 (permalink)

    Hi Ivan,
    I did few testing but not sure if this will work at your end. For me it did.
    I have to change the type to "type="CustomLists, App_SubCode_CSCode". If I leave it as . If I leave it as "type="CustomLists, App_Code" I get error in user control section.
    And if I had already used this control in a page then I will get error when viewing the page. I have to go to edit mode of the page, delete the control and add it again. Doing this worked for me.
    Could you please try at your end? thanks

    Reply

  • Rabindra Intermediate avatar

    Posted on Apr 20, 2010 (permalink)

    Ok, I didn't fully test it before so please ignore my previous posts.
    I am still having problem. Here is what I did so far.

    If I don't change App_Code I get an error on "Select a control" section. Pls see image1. I can't do anything.
    <add name="Sorted List" section="Custom controls" type="CustomLists, App_Code" description="Sorted List"/>


    But if I change App_code to App_SubCode_CSCode, I don't get an error under "Select a control". Pls see image2.
    <add name="Sorted List" section="Custom controls" type="CustomLists, App_SubCode_CSCode" description="Sorted List"/>
    So, I can drag and drop the control to the page and change settings. I can save the page and publish it. It works fine.
    But if I rebuild the website I get an error.

    Could not load file or assembly 'App_SubCode_CSCode.1fwr_i1l, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

    Can you please help?
    Attached files

    Reply

  • Register for webinar
Skip Navigation LinksHome / Developer Network / Forums / Sitefinity 3.x: Developing with Sitefinity > c# and vb.net in App_code