Removing Obsolete Attributes from Office Projects that You Migrate to the .NET Framework 4

When the target framework of an Office project is changed to the .NET Framework 4, you must remove obsolete attributes from the projects in the following scenarios:

  • You upgrade an Office project from Visual Studio 2008. In this case, you must remove the SecurityTransparentAttribute.

  • You change the target framework of an Excel project. In this case, you must remove the Microsoft.Office.Tools.Excel.ExcelLocale1033Attribute.

Visual Studio does not automatically remove these attributes when the target framework is changed.

If you upgrade an Office project from Visual Studio 2008 and the target framework of the project subsequently changes to the .NET Framework 4, you must remove the SecurityTransparentAttribute from the project. For more information about the conditions in which Visual Studio can change the target framework of an upgraded project to the .NET Framework 4, see Upgrading and Migrating Office Solutions.

To remove the SecurityTransparentAttribute

  1. With the project open in Visual Studio, open Solution Explorer.

  2. Under the Properties node (for C#) or the My Project node (for Visual Basic), double-click the AssemblyInfo code file to open it in the code editor.

    NoteNote

    In Visual Basic projects, you must click the Show All Files button in Solution Explorer to see the AssemblyInfo code file.

  3. Locate the SecurityTransparentAttribute and either remove it from the file or comment it out.

    <Assembly: SecurityTransparent()>
    
    

    [assembly: SecurityTransparent()]
    
    

If the target framework of an Excel project is changed to the .NET Framework 4, you must remove the Microsoft.Office.Tools.Excel.ExcelLocale1033Attribute from the project. This attribute has been removed from the portion of the Visual Studio Tools for Office runtime that is used for solutions that target the .NET Framework 4. The common language runtime (CLR) in the .NET Framework 4 always passes locale ID 1033 to the Excel object model, and you can no longer use this attribute to disable this behavior. For more information, see Formatting Data in Excel with Various Regional Settings.

To remove the ExcelLocale1033Attribute

  1. With the project open in Visual Studio, open Solution Explorer.

  2. Under the Properties node (for C#) or the My Project node (for Visual Basic), double-click the AssemblyInfo code file to open it in the code editor.

    NoteNote

    In Visual Basic projects, you must click the Show All Files button in Solution Explorer to see the AssemblyInfo code file.

  3. Locate the Microsoft.Office.Tools.Excel.ExcelLocale1033Attribute and either remove it from the file or comment it out.

    <Assembly: ExcelLocale1033Proxy(True)>
    
    

    [assembly: ExcelLocale1033Proxy(true)]
    
    

Community Additions

Show: