trust level does not allow use of the 'compilerOptions' attribute


  • I am having a devil of a time getting a couple of VB 2003 web apps that have been converted to VB 2005 to run on the remote server I use ... I am able to debug/run them on my local development machine.  The problem seems to be centered around the web.config files for these apps.  They each contain <compilation> elements with embedded <compilers> and <compiler ...> child elements.  The <compiler ...> element has a number of attributes including compilerOptions.  When I run each app from the server I get the following message:

    Parser Error Message: The current trust level does not allow use of the 'compilerOptions' attribute

    I have been in touch with the server folks (where I had been running the VB 2003 version w/.Net 1.0 without difficulty) and they claim that they have converted me over to .Net 2.0 and I have the proper permissions, etc. ... yet this problem persists.  Can someone suggest what may be going on here and how I might extricate myself from this situation?

    Another curious aspect of this: one of the apps has a squiggly blue line under the <compilation> element which when I hover over it says somehting to the effect that <compilers> is not a valid child element of <compilation>.  What in the world is THAT all about ... and why would the 2003-to-2005 conversion wizard create an invalid web.config file?!?  The other app does not have this squiggly line but it also has <compilers> as a child element of <compilation> ... it also has an <assemblies> element [which the other app does not] ... and three <add assembly ... > directives each of which involves Crystal.Decisions!  I don't have a clue what that's all about.

    I think I am close to getting these apps running but I could sure use some help (or references to help) for how to deal with these problems.

    Wednesday, January 24, 2007 11:27 PM

All replies

  • Solution 1:

    To solve the problem, you have to remove the compilerOptions setting and the warningLevel setting, from configuration section in web.config file after creating or migrating the application. After the change, the settings should appear as follows:

          <compiler language="c#;cs;csharp" extension=".cs"
             type="Microsoft.CSharp.CSharpCodeProvider,System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <providerOption name="CompilerVersion" value="v3.5"/>
          <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
             type="Microsoft.VisualBasic.VBCodeProvider, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <providerOption name="CompilerVersion" value="v3.5"/>

    Solution 2:

    To solve the problem open the web.config file and add/change the trust level as follows:

       <trust level="Full"/>

    Finally, rebuild the project.

    Omanakuttan M.K.
    NOTE - Disclaimer


    By using the following materials or sample code you agree to be bound by the license terms below and the Microsoft Partner Program Agreement the terms of which are incorporated herein by this reference. These license terms are an agreement between Microsoft Corporation (or, if applicable based on where you are located, on of its affiliates) and you. Any materials (other than sample code) we provide to you are for your internal use only. Any sample code is provided for the purpose of illustration only and is not intended to be used in a production environment. We grant you a nonexclusive, royalty-free right to use and modify the sample code and to reproduce and distribute the object code form of the sample code, provided that you agree: (i) to not use Microsoft's name, logo, or trademarks to market your software produced in which the sample code is embedded; (ii) to include a valid copyright notice on your software product in which the sample code is embedded; (iii) to provide on behalf of and for the benefit of your subcontractors a disclaimer of warranties, exclusion of liability for indirect and consequential damages and a responsible limitation of liability; and (iv) to indemnify, hold harmless, and defend Microsoft, its affiliates and suppliers from and against any third party claims or lawsuits, including attorney's fees, that arise or result from the use or distribution of the sample code.

    Wednesday, November 18, 2009 2:39 PM