RE: Settings inaccessible due to its protection level

Discussion in 'ASP .Net' started by Walter Wang [MSFT], Jan 11, 2007.

  1. Hi Dale,

    Would you please depict more about your project and how is the Setting
    located and used? A reproducible project will be excellent.

    Basically, the *.settings file is associated with custom tool
    "SettingsSingleFileGenerator" and generates a strong-typed class for
    various properties. It's intended to be used in the same assembly,
    therefore the "internal" keyword is used on it. This means only code in the
    same assembly could use it.

    If you're using the Web Application Project add-on (included in VS2005 SP1
    or can be installed separately), the web project should be compiled into
    one assembly and this should be ok for the Settings class. However, for
    default web site project mode, different webform files will be compiled
    into separate assemblies and therefore they will not be able to access the
    Settings class. For more information about ASP.NET compilation model, see:

    #ASP.NET Compilation Overview
    http://msdn2.microsoft.com/en-us/library/ms178466(VS.80).aspx
    ASP.NET automatically compiles your application code and any dependent
    resources the first time a user requests a resource from the Web site. In
    general, ASP.NET creates an assembly for each application directory (such
    as App_Code) and one for the main directory.


    To compile into one assembly, you could use Web Deployment Project:

    #Visual Studio 2005 Web Deployment Projects
    http://msdn2.microsoft.com/en-us/asp.net/aa336619.aspx
    Visual Studio 2005 Web Deployment Projects provide additional functionality
    to build and deploy Web sites and Web applications in ASP.NET 2.0 and
    Visual Studio 2005. This add-in includes a tool to merge the assemblies
    created during ASP.NET 2.0 pre-compilation, and provides a comprehensive UI
    within Visual Studio 2005 to manage build configurations, merging, and
    using pre-build and post-build tasks with MSBuild.


    Sincerely,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications. If you are using Outlook Express, please make sure you clear the
    check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
    promptly.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Walter Wang [MSFT], Jan 11, 2007
    #1
    1. Advertising

  2. I think the problem had something to do with the Projects add-in. Though I
    had set it to use only one dll, and verified that it was doing that, I still
    had the problem. Because I wanted to use the SchemaImporterExtension class
    which would not work with the Web Projects add-in and its early defined web
    reference model, I had to convert the project to a standard VS2005 web site.
    When I did that, this problem with accessibility to the Settings class went
    away.

    Thanks,

    Dale

    --
    Dale Preston
    MCAD C#
    MCSE, MCDBA


    "Walter Wang [MSFT]" wrote:

    > Hi Dale,
    >
    > Would you please depict more about your project and how is the Setting
    > located and used? A reproducible project will be excellent.
    >
    > Basically, the *.settings file is associated with custom tool
    > "SettingsSingleFileGenerator" and generates a strong-typed class for
    > various properties. It's intended to be used in the same assembly,
    > therefore the "internal" keyword is used on it. This means only code in the
    > same assembly could use it.
    >
    > If you're using the Web Application Project add-on (included in VS2005 SP1
    > or can be installed separately), the web project should be compiled into
    > one assembly and this should be ok for the Settings class. However, for
    > default web site project mode, different webform files will be compiled
    > into separate assemblies and therefore they will not be able to access the
    > Settings class. For more information about ASP.NET compilation model, see:
    >
    > #ASP.NET Compilation Overview
    > http://msdn2.microsoft.com/en-us/library/ms178466(VS.80).aspx
    > ASP.NET automatically compiles your application code and any dependent
    > resources the first time a user requests a resource from the Web site. In
    > general, ASP.NET creates an assembly for each application directory (such
    > as App_Code) and one for the main directory.
    >
    >
    > To compile into one assembly, you could use Web Deployment Project:
    >
    > #Visual Studio 2005 Web Deployment Projects
    > http://msdn2.microsoft.com/en-us/asp.net/aa336619.aspx
    > Visual Studio 2005 Web Deployment Projects provide additional functionality
    > to build and deploy Web sites and Web applications in ASP.NET 2.0 and
    > Visual Studio 2005. This add-in includes a tool to merge the assemblies
    > created during ASP.NET 2.0 pre-compilation, and provides a comprehensive UI
    > within Visual Studio 2005 to manage build configurations, merging, and
    > using pre-build and post-build tasks with MSBuild.
    >
    >
    > Sincerely,
    > Walter Wang (, remove 'online.')
    > Microsoft Online Community Support
    >
    > ==================================================
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    > ications. If you are using Outlook Express, please make sure you clear the
    > check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
    > promptly.
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/subscriptions/support/default.aspx.
    > ==================================================
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
     
    =?Utf-8?B?RGFsZQ==?=, Jan 19, 2007
    #2
    1. Advertising

  3. Dale,

    Thanks for the update and sharing your experience to the community. Please
    feel free to let me know if there's anything else I can help.

    Regards,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Walter Wang [MSFT], Jan 19, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Shohet
    Replies:
    1
    Views:
    483
    William F. Robertson, Jr.
    Aug 1, 2003
  2. Arjen
    Replies:
    1
    Views:
    5,065
    Arjen
    Jun 11, 2005
  3. sck10
    Replies:
    2
    Views:
    36,291
    sck10
    Aug 28, 2006
  4. Iain
    Replies:
    5
    Views:
    631
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
    Feb 20, 2007
  5. Chip Gore
    Replies:
    6
    Views:
    2,202
    Ben Voigt [C++ MVP]
    Apr 10, 2008
Loading...

Share This Page