RE: Settings inaccessible due to its protection level

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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 (wawang@xxxxxxxxxxxxxxxxxxxx, 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.


.



Relevant Pages

  • RE: vbc compiler error code 1
    ... assembly set producted by ASP.NET application dynamic compilation. ... inconsistency between new dynamic compiled assemblies and the old cached ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: httpModule for Unhandled Exceptions
    ... ASP.NET 2.0 introduced new compilation model which creates separate ... assemblies for the contents of the App_Code directory as well as the ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Satellite assemblies could not be built - Cslangsvc.dll required
    ... It is giving you a list of assemblies it could not find during compilation. ... > Preparing resources... ... > Building satellite assemblies... ...
    (microsoft.public.dotnet.general)
  • RE: Could not load file or assembly App_Web_tod59ga8 and similar
    ... > compiled assemblies of the UserControl or any dependencs are invisible ... > the same folder, if we use purely dynamic compilation, the usercontrol ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Reg-Free COM Error
    ... and contact customer support if I can't figure it out. ... assemblies when I use Reg-Free COM. ... modify my manifest file before it compiles as a resource, ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.interop)