locked
Custom rules in fxcop C# for Pascal casing or Camel Casing RRS feed

  • Question

  • Hi,

    I have to write a custom rule for naming convention. As I have to use Camel Case or Pascal Case name... I m able to write XML file for that but I m not understanding how to write c# code.

    I m working with FxCop 10.0 and VS2010

    If any sample code or links are available for that then it will help me.

    The instruction for my project is as

    1.        Always use Camel Case for Variable name and Method Arguments or Pascal Case names for class/Method names.

     

    Urgent reply needed.

    Any help/Suggestions will be appreciated.

    Monday, November 28, 2016 10:13 AM

All replies

  • Hi,

    I have to write a custom rule for naming convention. As I have to use Camel Case or Pascal Case name... I m able to write XML file for that but I m not understanding how to write c# code.

    I m working with FxCop 10.0 and VS2010

    If any sample code or links are available for that then it will help me.

    The instruction for my project is as

    1.        Always use Camel Case for Variable name and Method Arguments or Pascal Case names for class/Method names.

     

    Urgent reply needed.

    Any help/Suggestions will be appreciated.


    Tuesday, November 29, 2016 4:44 AM
  • Hi AparnaJois,

    About how to use FxCop you could refer to the following MSDN document:

    https://msdn.microsoft.com/en-us/library/bb429476(v=vs.80).aspx

    The following blog is: How to write custom static code analysis rules and integrate them into Visual Studio 2010, which may be helpful for you.

    https://blogs.msdn.microsoft.com/codeanalysis/2010/03/26/how-to-write-custom-static-code-analysis-rules-and-integrate-them-into-visual-studio-2010/

    Please refer to the following thread about Custom Rule for Camel Case or Pascal Case names, that may be helpful for you:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/a1b030d2-7021-4513-841e-56ebedac136a/fxcop136-custom-rule-for-camel-case-or-pascal-case-names?forum=vstscode

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Oscar_Wu Tuesday, November 29, 2016 9:01 AM
    • Unproposed as answer by Oscar_Wu Wednesday, November 30, 2016 4:50 AM
    Tuesday, November 29, 2016 5:49 AM
  • Thank you Oscar for sharing the Useful Links ....

    Unfortunately i couldn't able to solve the issue Please suggest any appropriate document/Links to test for Pascal /Camel case.

    • Edited by AparnaJois Tuesday, November 29, 2016 9:12 AM
    Tuesday, November 29, 2016 9:00 AM
  • Hi friend,

    If my reply help you resolved your issue, would you please mark it as answer, which could help others who has the same issue as yours. If not, please feel free to let me know. Thank you very much.

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Oscar_Wu Tuesday, November 29, 2016 9:03 AM
    Tuesday, November 29, 2016 9:02 AM
  • Sorry I cannot mark it as answer since i couldn't solve the issue....

    Thanks for reply


    Aparna

    Wednesday, November 30, 2016 4:47 AM
  • Hi friend,

    The following blog may be helpful for you:

    https://blog.tatham.oddie.com.au/2010/01/06/custom-code-analysis-rules-in-vs2010-and-how-to-make-them-run-in-fxcop-and-vs2008-too/

    Disclaimer: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 30, 2016 10:09 AM