C # Coding specification 3

Source: Internet
Author: User

Project Settings and Project Structure

  1. Always build your projects with Warning Level 4 (see Figure E-1 ).

  2. Treat warnings as errors in the Release build (note that this
    Is not the default of Visual Studio). Although it is optional, this standard
    Recommends treating warnings as errors in Debug builds as well.

  3. Avoid suppressing specific compiler warnings.

  4. Always explicitly state your supported runtime versions in
    Application configuration file:

    <?xml version="1.0"?>
    <configuration>
    <startup>
    <supportedRuntime version="v2.0.5500.0"/>
    <supportedRuntime version="v1.1.5000.0"/>
    </startup>
    </configuration>

     

    Figure E-1. The project Build pane

  5. Avoid explicit custom version redirection and binding to CLR
    Assemblies.

  6. Avoid explicit preprocessor definitions (# Define). Use
    The project settings for defining conditional compilation constants.

  7. Do not put any logic inside AssemblyInfo. cs.

  8. Do not put any assembly attributes in any file other than AssemblyInfo. cs.

  9. Populate all fields in AssemblyInfo. cs, such as company name, description, and
    Copyright notice.

  10. All assembly references shocould use relative paths.

  11. Disallow cyclic references between assemblies.

  12. Avoid multi-module assemblies.

  13. Avoid tampering with exception handling using the Exception
    Window (Debug Exceptions ).

  14. Strive to use uniform version numbers on all assemblies and
    Clients in the same logical application (typically, a solution). Use the SolutionInfo. cs technique from Chapter 5 to automate.

  15. Name your Visual Studio 2005 application configuration file
    App. config, and include it in
    Project.

  16. Modify the Visual Studio 2005 default project structure to your
    Project's standard layout, and apply a uniform structure for project folders and
    Files.

  17. A release build shoshould debug in debug symbols (see Figure E-2 ).

     

    Figure E-2. The Advanced Build Settings dialog

  18. Always Sign your assemblies, including the client
    Applications.

  19. Use password-protected keys.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.