Using Visual C# code in Visual Web Developer Express Edition

for aspx development, I'm using Visual Web Developer Express Edition.

Is there any way to share classes that I develop in Visual C# in Web Developer

I know I can copy *.cs files to the "App_Code" folder, but I would prefer to have them both using the same file ( a la "add as link" ).

Also, when I *do* copy classes to the "App_Code" folder, the web site runs fine in the Web Developer IDE, but if I try to navigate to it in my browser, I get an error message saying it doesn't recognize the class. ( This is more of a Web Developer question, I grant you, but since I'm on the subject, I hope its alright to ask... )

Thanks for any help,

Kirk




Answer this question

Using Visual C# code in Visual Web Developer Express Edition

  • RMD

    Lets say I've Declared MyClass in MyNamespace and created MyClass.dll.

    What does the header of my web page look like

    thanks,

    Kirk

    ps - in my original question, "sharing" meant that I only used one *.cs file for both environments and that any change I made while i was in Visual C# would "automatically" be used by Web Developer. Said another way, I don't want to wind up with two versions of the same source code.



  • WehSo

    I never knew you are adding everything to the aspx file, usually there is code file attached to every aspx page, if you rite click on your file and say show source, it should come up...

    Or you can do something like this depending on the namespace, say your project was mynamespace...After you add it as refrence...

    <%@ Import Namespace="mynamespace" %>

    the above statement will add the refrence to the dll.....

    and if you are adding it your code file, then should be

    using mynamespace

    Hope this helps...


  • Neil_D_Jones

    I want to make sure I know what you mean.

    Normally, my web pages have what I call a "header" - the first few lines at the top, that look something like this:

    <%@ Page Language="C#" Debug="true"%>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.SqlClient" %>


    I thought that I would need another "import" to bring in the DLL.

    If that is not the case, where do I put a "using" in in a web page At the top of the script section

    In other words, like this

    <script language="C#" runat="server" >

    Using MyNamespace;

    ( .... some code )

    </script



  • h1

    What exactly you mean by sharing.

    What you can create is a dll of Visual C# classes and let your Website use that .dll, if you don't want to copy in the App_Code folder. making a .dll is much cleaner...


  • Dobyns

    There is no header, Just add the dll to your project by adding a refrence and then say

    using MyNamespace;

    that will you should be able to use the public methods available in dll.....

    ....Sharing I don't know if that will work...The besy way IMHO is dll.....

    Hope this helps.

    Thanks,

    Harsimrat


  • Using Visual C# code in Visual Web Developer Express Edition