FxCop – Part III (A detailed explanation over Project and its functionalities)
In the Part I we saw the introduction to FxCop and in Part II we saw about the startup usage of FxCop. In this Part III we are going to see in detail about FxCop Project and its features.
Here we dived the explanations over the Project into 2, they are:
· Basics of Project
· Advanced features of Project
Basics of Project:
In this we will see the basics of FxCop Project which needs little explanation. The topics we are going to cover here are:
1. Creating a new project
2. Open an existing project
3. Saving project
4. Opening Recent Projects
5. Saving Reports
6. Importing Reports
7. Adding Targets
8. Adding Rules
9. Analyzing a Project
10. Viewing Analysis Summary
1. Creating a new Project:
To create a new project,
Click File > New Project.
2. Open an existing project
To open an exiting project,
· File > Open Project
· Select the project file you want to open from the location you stored it or the location in which it is available.
· Click Open button.
3. Saving project
You can save the project in 2 ways, as follows,
i) When you are saving it for the first time
ii) When you are saving one more copy of the project.
a) When you are saving it for the first time
· Click File > Save Project or Ctrl S
· Select the path where you want to save it
· Enter the name of the project you want to save in
· Click Save
b) When you are saving one more copy of the project
· Click File > Save Project as
· Select the path where you want to save it
· Enter the name of the project you want to save in
· Click Save
4. Opening Recent Projects
To open Opening Recent Projects,
a) Click File > Recent Projects
b) Select the desired project
5. Saving Reports
To save reports,
· Click File > Save Report as
· Select the path where you want to save it
· Enter the name of the Report you want to save in
· Click Save
6. Importing Reports
To Import Reports,
· Click File > Import Reports or Ctrl I
· Select the Report file you want to open from the location you stored it or the location in which it is available.
· Click Open button
7. Adding Targets
To add Target,
· Project > Add Targets.
· Select the desired assembly you want to analyze(it can either be a dll or an exe).
8. Adding Rules
To Add Rules,
· Project > Add Rules.
· Select the desired Rules dll from the location you are having the rules.
9. Analyzing a Project
To analyze a project, its given in detail in the earlier chapters. Anyhow its given here once more for continuity or completeness of the topic.
· Select the desired assembly you want to analyze (it can either be a .dll or an .exe).
· For example, I am selecting here a .net application (Which was downloaded from internet)
· If you have selected multiple assemblies then select any one of them (the one you want to analyze first) and then click Project > Analyze or press F5 or Click Analyze from toolbar.
· Analyzing with introspection Engine dialog box will appear when the analysis is under process.
· Then it will display list of messages in the right pane.
10. Viewing Analysis Summary
To view Analysis Summary report,
· Click Project > Analysis summary
· Analysis summary window will appear.
· Click ok to close the window.
Advanced features of Project:
In this we will Advanced features of FxCop Project which needs some explanation. The topics we are going to cover here are:
1. General Project settings
2. Saving and Compression settings
3. Spelling and Analysis settings
4. Preferences Settings
5. Font and colors settings
6. Analysis Engine settings
1. General Project settings
For doing General Project settings,
· Click Project > Options
· Select General tab
Here you can do the things like:
(1) Changing Project name
(2) Changing Report style sheet path
(3) Save messages settings for Project and Reports
2. Saving and Compression settings
For doing this,
· Click Project > Options
· Select Saving and Compression tab
Here you can do the things like:
(1) Project Save settings
(2) Project File name Rule settings
(3) Compression settings
3. Spelling and Analysis settings
For doing this,
· Click Project > Options
· Select Spelling and Analysis tab
Here you can do the things like:
(1) Multithreading settings
(2) GAC settings
(3) Spelling and analysis settings
4. Preferences Settings
For doing this,
· Click Tools > Settings
· Select Preferences tab
Here you can do the things like:
(1) General preference settings like checking for updates in startup,etc
(2) Filtering messages
(3) Launching in source code editor
(4) Command line settings
5. Font and colors settings
For doing this,
· Click Tools > Settings
· Select Font and colors tab
As the name implies, it does the font and color related settings.
6. Analysis Engine settings
For doing this,
· Click Tools > Settings
· Select Analysis Engine tab
Here you can do the things like:
(1) Engine related settings
(2) Some more advanced settings.
FxCop – Part III (A detailed explanation over Project)
Thursday, June 25, 2009
Labels:
codeanalysis,
FxCop
SharePoint for all – Chapter I (Introduction to the basics of SharePoint)
SharePoint for all – Chapter I (Introduction to the basics of SharePoint)
This will be a series of articles on SharePoint, which explains from the basics to advanced usage of SharePoint and its group of products. This article is the first of them which gives an introduction to SharePoint. In the coming chapters, we will see the features of SharePoint in depth.
SharePoint is said to be one of the fastest growing technologies from Microsoft.
Definition:
It is a browser-based Content Management System with collaboration features from Microsoft.
It can be configured to run intranet, extranet and internet sites.
Microsoft’s Definition:
Microsoft Office SharePoint Server 2007 is an integrated suite of server capabilities that can help improve organizational effectiveness by providing comprehensive content management and enterprise search, accelerating shared business processes, and facilitating information-sharing across boundaries for better business insight. Additionally, this collaboration and content management server provides IT professionals and developers with the platform and tools they need for server administration, application extensibility, and interoperability.
SharePoint Products:
Microsoft lists the following as the SharePoint Products and Technology family:
1. WSS (Windows SharePoint Services)
2. MSS (Microsoft Search Server)
3. Forms Server
4. MOSS (Microsoft Office SharePoint Server)
IDE’s for developing SharePoint Products:
1. Visual studio
2. Microsoft Office SharePoint Designer
1. WSS
Windows SharePoint Services is foundation for all SharePoint based products. It is an object model for creating web pages which does document management and collaboration and centralized document repository.
The latest version of WSS is 3.0. You can download WSS 3.0 from the following link,
http://msdn.microsoft.com/en-us/sharepoint/default.aspx
2. MSS
Microsoft Search Server is an enterprise search platform from Microsoft, based on the search capabilities of Microsoft Office SharePoint server. –Wiki.
You can download MSS from the following link,
http://msdn.microsoft.com/en-us/library/bb931107.aspx
3. Forms Server
It is a server which allows InfoPath forms to be used on a browser. It allows even database operations.
4. MOSS
Microsoft Office SharePoint Server (MOSS) 2007 is a portal-based platform built over Windows SharePoint Services (WSS) 3.0. It organizes and aggregates an organization's information in one central, web-based application. MOSS enables users to create portals, has enterprise-level services, such as business intelligence and business process integration, etc.
Used for:
It is primarily used for Content Management, Collaboration, organizing and aggregating an enterprise's data into web-based portal. For e.g. Knowledge Management Portal.
Advantages:
Many built-in features, Rich Security, Content Management, Integration with Office products, business process can be integrated with workflows, less effort to create basic sites with standard functionalities such as search etc.
Hierarchy:
Web Application -> Site Collection -> Sites->database (Content db, Config db, SSO db). An interesting point to note here is that the equivalent of .Net website here is Web Application and not the sites under site collection. Also the databases are encrypted hence developers can't view data.
Study Material from Microsoft:
http://office.microsoft.com/en-us/sharepointserver/FX100492001033.aspx
http://sharepoint.microsoft.com/Pages/Default.aspx
Study Material from Others:
http://www.fpweb.net/sharepoint-hosting/free-sharepoint-tutorials.asp
http://blog.sharepointhosting.com/Downloads/SharePoint-Tutorials.aspx
http://www.cudenver.edu/RESOURCES/WEBDEVELOPMENT/CMSRESOURCES/TUTORIALS/CREATESPSITE/Pages/CreateaSharePointsite.aspx
http://www.softwaretrainingtutorials.com/ms-sharepoint.php
System Requirements:
Hardware Requirements suggested by Microsoft:
Component Minimum Recommended
Processor 2.5 gigahertz (GHz) Dual processors that are each 3 GHz or faster
RAM 1 gigabyte (GB) 2 GB
Disk NTFS file system–formatted partition with a minimum of 3 GB of free space NTFS file system–formatted partition with 3 GB of free space plus adequate free space for your Web sites
Drive DVD drive DVD drive or the source copied to a local or network-accessible drive
Display 1024 × 768 1024 × 768 or higher resolution monitor
Network 56 kilobits per second (Kbps) connection between client computers and server 56 Kbps or faster connection between client computers and server
For detailed information on the System requirements for SharePoint, see the following link,
http://technet.microsoft.com/hi-in/library/cc288751(en-us).aspx
This will be a series of articles on SharePoint, which explains from the basics to advanced usage of SharePoint and its group of products. This article is the first of them which gives an introduction to SharePoint. In the coming chapters, we will see the features of SharePoint in depth.
SharePoint is said to be one of the fastest growing technologies from Microsoft.
Definition:
It is a browser-based Content Management System with collaboration features from Microsoft.
It can be configured to run intranet, extranet and internet sites.
Microsoft’s Definition:
Microsoft Office SharePoint Server 2007 is an integrated suite of server capabilities that can help improve organizational effectiveness by providing comprehensive content management and enterprise search, accelerating shared business processes, and facilitating information-sharing across boundaries for better business insight. Additionally, this collaboration and content management server provides IT professionals and developers with the platform and tools they need for server administration, application extensibility, and interoperability.
SharePoint Products:
Microsoft lists the following as the SharePoint Products and Technology family:
1. WSS (Windows SharePoint Services)
2. MSS (Microsoft Search Server)
3. Forms Server
4. MOSS (Microsoft Office SharePoint Server)
IDE’s for developing SharePoint Products:
1. Visual studio
2. Microsoft Office SharePoint Designer
1. WSS
Windows SharePoint Services is foundation for all SharePoint based products. It is an object model for creating web pages which does document management and collaboration and centralized document repository.
The latest version of WSS is 3.0. You can download WSS 3.0 from the following link,
http://msdn.microsoft.com/en-us/sharepoint/default.aspx
2. MSS
Microsoft Search Server is an enterprise search platform from Microsoft, based on the search capabilities of Microsoft Office SharePoint server. –Wiki.
You can download MSS from the following link,
http://msdn.microsoft.com/en-us/library/bb931107.aspx
3. Forms Server
It is a server which allows InfoPath forms to be used on a browser. It allows even database operations.
4. MOSS
Microsoft Office SharePoint Server (MOSS) 2007 is a portal-based platform built over Windows SharePoint Services (WSS) 3.0. It organizes and aggregates an organization's information in one central, web-based application. MOSS enables users to create portals, has enterprise-level services, such as business intelligence and business process integration, etc.
Used for:
It is primarily used for Content Management, Collaboration, organizing and aggregating an enterprise's data into web-based portal. For e.g. Knowledge Management Portal.
Advantages:
Many built-in features, Rich Security, Content Management, Integration with Office products, business process can be integrated with workflows, less effort to create basic sites with standard functionalities such as search etc.
Hierarchy:
Web Application -> Site Collection -> Sites->database (Content db, Config db, SSO db). An interesting point to note here is that the equivalent of .Net website here is Web Application and not the sites under site collection. Also the databases are encrypted hence developers can't view data.
Study Material from Microsoft:
http://office.microsoft.com/en-us/sharepointserver/FX100492001033.aspx
http://sharepoint.microsoft.com/Pages/Default.aspx
Study Material from Others:
http://www.fpweb.net/sharepoint-hosting/free-sharepoint-tutorials.asp
http://blog.sharepointhosting.com/Downloads/SharePoint-Tutorials.aspx
http://www.cudenver.edu/RESOURCES/WEBDEVELOPMENT/CMSRESOURCES/TUTORIALS/CREATESPSITE/Pages/CreateaSharePointsite.aspx
http://www.softwaretrainingtutorials.com/ms-sharepoint.php
System Requirements:
Hardware Requirements suggested by Microsoft:
Component Minimum Recommended
Processor 2.5 gigahertz (GHz) Dual processors that are each 3 GHz or faster
RAM 1 gigabyte (GB) 2 GB
Disk NTFS file system–formatted partition with a minimum of 3 GB of free space NTFS file system–formatted partition with 3 GB of free space plus adequate free space for your Web sites
Drive DVD drive DVD drive or the source copied to a local or network-accessible drive
Display 1024 × 768 1024 × 768 or higher resolution monitor
Network 56 kilobits per second (Kbps) connection between client computers and server 56 Kbps or faster connection between client computers and server
For detailed information on the System requirements for SharePoint, see the following link,
http://technet.microsoft.com/hi-in/library/cc288751(en-us).aspx
Labels:
Infopath,
MOSS,
MSS,
sharepoint,
WSS
Design Patterns for all – Chapter II (Singleton Pattern)
Monday, June 22, 2009
Design Patterns for all – Chapter II (Singleton Pattern)
In the previous chapter we saw the basics of Design patterns and OOPs which will give the foundation for understanding Design patterns better. In this chapter we are going to see the Singleton Pattern in detail with c# coding.
Singleton Pattern:
It comes under the category of ‘Creational Pattern’.
Definition:
It allows a single instance of a class and provides global access to it.
Steps to implement a Singleton Pattern in C#:
1. Create a sealed class.
2. Declare a private variable for that class inside the class.
3. Make the constructor as private.
4. Create a public static property which only returns the instance
5. Inside that use lock() to handle the object instance for supporting multi-threading functionality.
Applicability:
1. Logger
It is primarily used in the areas where single access channel is needed. Logging is an area where it is primarily used.
2. Db Connection
For managing database connections also it is used as there should be only one connection at a time.
3. Configuration Manager
Then configuration managers, which read and write to configuration files, there also Singletons are used.
A Logger example in C#:
Steps to write it:
1. Select Visual studio > Project > C# & Windows Application.
2. Follow the steps given in the steps to write a Singleton class above
3. The complete code of the Singleton Pattern and its usage class are given below :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace SingletonDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
MySingleton sg = MySingleton.Instance;
sg.LogMyError("test");
}
}
public sealed class MySingleton
{
private static volatile MySingleton instSingleton;
private static object objSynformultithread = new Object();
private MySingleton()
{
}
public void LogMyError(String msg)
{
TextWriter twLog = new StreamWriter("c:\\log.txt");
// write a line of text to the file
twLog.WriteLine("Start" + DateTime.Now);
twLog.WriteLine(msg);
twLog.WriteLine("End");
// close the stream
twLog.Close();
}
public static MySingleton Instance
{
get
{
if (instSingleton == null)
{
lock (objSynformultithread)
{
if (instSingleton == null)
instSingleton = new MySingleton();
}
}
return instSingleton;
}
}
}
}
Explanations over the Program:
Purpose of Sealed:
It prevents derivation which could add instances.
Purpose of Private Static Volatile:
Private, it makes the variable private and so not accessible from outside.
Static, without creating instance (only the instance created inside) we can call with name of the class as MySingleton.variable.
Volatile, makes the instance variable assignment completed before it is accessed.
Purpose of Lock:
It avoids deadlocks, enables multithreaded functionality.
The above program has the function LogMyError which does the logging to the file system. You can change the file name and path wherever you want it to get stored. Moreover it was written for a demo purpose only, so its not that much fuller. You need to add the append functionality to it such that it works as according to your need.
If you do the minor modifications based on your need of logging then it will be a good Logger for any kind of application.
Similarly it can be used for DB Connection, Configuration Management, etc.
In the previous chapter we saw the basics of Design patterns and OOPs which will give the foundation for understanding Design patterns better. In this chapter we are going to see the Singleton Pattern in detail with c# coding.
Singleton Pattern:
It comes under the category of ‘Creational Pattern’.
Definition:
It allows a single instance of a class and provides global access to it.
Steps to implement a Singleton Pattern in C#:
1. Create a sealed class.
2. Declare a private variable for that class inside the class.
3. Make the constructor as private.
4. Create a public static property which only returns the instance
5. Inside that use lock() to handle the object instance for supporting multi-threading functionality.
Applicability:
1. Logger
It is primarily used in the areas where single access channel is needed. Logging is an area where it is primarily used.
2. Db Connection
For managing database connections also it is used as there should be only one connection at a time.
3. Configuration Manager
Then configuration managers, which read and write to configuration files, there also Singletons are used.
A Logger example in C#:
Steps to write it:
1. Select Visual studio > Project > C# & Windows Application.
2. Follow the steps given in the steps to write a Singleton class above
3. The complete code of the Singleton Pattern and its usage class are given below :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace SingletonDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
MySingleton sg = MySingleton.Instance;
sg.LogMyError("test");
}
}
public sealed class MySingleton
{
private static volatile MySingleton instSingleton;
private static object objSynformultithread = new Object();
private MySingleton()
{
}
public void LogMyError(String msg)
{
TextWriter twLog = new StreamWriter("c:\\log.txt");
// write a line of text to the file
twLog.WriteLine("Start" + DateTime.Now);
twLog.WriteLine(msg);
twLog.WriteLine("End");
// close the stream
twLog.Close();
}
public static MySingleton Instance
{
get
{
if (instSingleton == null)
{
lock (objSynformultithread)
{
if (instSingleton == null)
instSingleton = new MySingleton();
}
}
return instSingleton;
}
}
}
}
Explanations over the Program:
Purpose of Sealed:
It prevents derivation which could add instances.
Purpose of Private Static Volatile:
Private, it makes the variable private and so not accessible from outside.
Static, without creating instance (only the instance created inside) we can call with name of the class as MySingleton.variable.
Volatile, makes the instance variable assignment completed before it is accessed.
Purpose of Lock:
It avoids deadlocks, enables multithreaded functionality.
The above program has the function LogMyError which does the logging to the file system. You can change the file name and path wherever you want it to get stored. Moreover it was written for a demo purpose only, so its not that much fuller. You need to add the append functionality to it such that it works as according to your need.
If you do the minor modifications based on your need of logging then it will be a good Logger for any kind of application.
Similarly it can be used for DB Connection, Configuration Management, etc.
Labels:
c#.net,
Design Patterns
Design Patterns for all – Chapter I (Introduction to Design patterns and OOPs)
Design Patterns for all – Chapter I (Introduction to Design patterns and OOPs)
In this chapter we will see the basics of Design patterns and OOPs which will give the foundation for understanding Design patterns better. In the coming chapters we will see the Design patterns in detail with practical examples and code.
Definition:
Design Patterns are best proven techniques for a common design problem.
It is only a design technique and not code. Though code is available for almost all design patterns in all popular languages, design patterns mean the design technique alone.
Each design pattern explains a repeated problem, gives standard solution to the problem.
History:
GoF Gang of four, a four member team (Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides) are said to be people who brought up this idea. They wrote some patterns which are considered the base for all other patterns.
Types of Patterns:
Design Patterns are generally classified into three categories, they are:
1. Creational
2. Structural
3. Behavioral
1. Creational
They deal with object creation. They provide you the best way to create objects based on the current situation.
Example:
Singleton, Factory method, Abstract factory, Builder
2. Structural
They deal with relationship between entities. They provide you the best way to relate entities on various scenarios.
Example:
Adapter, Aggregate, Bridge
3. Behavioral
They deal with communication between objects. They provide you the best way to communicate between objects.
Example:
Chain of responsibility, Command, Interpreter
Further Classification:
Though the above three are the major classification, one more category also exists which may be considered as a sub part of the above. It is:
Concurrency
They deal with multi-threaded programs. They provide solutions for multi-thread design problems.
Example:
Balking, Double checked locking, guarded suspension
OOP Techniques and Design Patterns:
Before going into design patterns, we need to know some of the OOP (Object Oriented Programming) features, which will in turn lead to a better understanding of Design patterns.
Let us now see the OOPs features one by one,
Class:
It defines characteristics of a thing and its behavior. It is blueprint from based on which objects are created.
Example: Employee (which will have all the details about the employee like name, id, salary, etc and the methods which describes his behavior like calcSalary(),displaydetails(),etc.
Object:
Is an instance of a class. It will be exactly the same as a class but can be assigned values and used whereas a class can’t be used without creating objects.
Inheritance:
A feature in which the base class’s characteristics and behavior are derived to the child class also.
Types:
Single
Multiple
Single:
A class inherits from a single class.
Multiple:
A class inherits from more than 1 class.
Abstraction:
“Abstraction is simplifying complex reality by modeling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem.” Is what the Wikipedia says.
Encapsulation:
It is a feature which hides data and functions from others classes.
Polymorphism:
A feature using which more than one definition is given to a single name. It can either be function polymorphism or operator overloading.
Association:
Association defines a relationship between classes of objects which allows one object to cause another to perform an action on its behalf.
Composition:
Composition is a way to combine simple objects or data types into more complex ones.
Aggregation:
Aggregation is a form of composition where one looks at the system as a whole rather than as parts.
In this chapter we will see the basics of Design patterns and OOPs which will give the foundation for understanding Design patterns better. In the coming chapters we will see the Design patterns in detail with practical examples and code.
Definition:
Design Patterns are best proven techniques for a common design problem.
It is only a design technique and not code. Though code is available for almost all design patterns in all popular languages, design patterns mean the design technique alone.
Each design pattern explains a repeated problem, gives standard solution to the problem.
History:
GoF Gang of four, a four member team (Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides) are said to be people who brought up this idea. They wrote some patterns which are considered the base for all other patterns.
Types of Patterns:
Design Patterns are generally classified into three categories, they are:
1. Creational
2. Structural
3. Behavioral
1. Creational
They deal with object creation. They provide you the best way to create objects based on the current situation.
Example:
Singleton, Factory method, Abstract factory, Builder
2. Structural
They deal with relationship between entities. They provide you the best way to relate entities on various scenarios.
Example:
Adapter, Aggregate, Bridge
3. Behavioral
They deal with communication between objects. They provide you the best way to communicate between objects.
Example:
Chain of responsibility, Command, Interpreter
Further Classification:
Though the above three are the major classification, one more category also exists which may be considered as a sub part of the above. It is:
Concurrency
They deal with multi-threaded programs. They provide solutions for multi-thread design problems.
Example:
Balking, Double checked locking, guarded suspension
OOP Techniques and Design Patterns:
Before going into design patterns, we need to know some of the OOP (Object Oriented Programming) features, which will in turn lead to a better understanding of Design patterns.
Let us now see the OOPs features one by one,
Class:
It defines characteristics of a thing and its behavior. It is blueprint from based on which objects are created.
Example: Employee (which will have all the details about the employee like name, id, salary, etc and the methods which describes his behavior like calcSalary(),displaydetails(),etc.
Object:
Is an instance of a class. It will be exactly the same as a class but can be assigned values and used whereas a class can’t be used without creating objects.
Inheritance:
A feature in which the base class’s characteristics and behavior are derived to the child class also.
Types:
Single
Multiple
Single:
A class inherits from a single class.
Multiple:
A class inherits from more than 1 class.
Abstraction:
“Abstraction is simplifying complex reality by modeling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem.” Is what the Wikipedia says.
Encapsulation:
It is a feature which hides data and functions from others classes.
Polymorphism:
A feature using which more than one definition is given to a single name. It can either be function polymorphism or operator overloading.
Association:
Association defines a relationship between classes of objects which allows one object to cause another to perform an action on its behalf.
Composition:
Composition is a way to combine simple objects or data types into more complex ones.
Aggregation:
Aggregation is a form of composition where one looks at the system as a whole rather than as parts.
Labels:
c#.net,
Design Patterns
Part II (A startup lesson on using FxCop)
Monday, June 15, 2009
Part II (A startup lesson on using FxCop)
In the previous article (FxCop Part I – Introduction), we saw the basics of FxCop , its definition, download path, comparison with other Code analysis tools, a simple demo for doing a analysis,etc.
In this article (Part II -A startup lesson on using FxCop), we are going to see the usage of FxCop at a beginner’s level.
As we saw in the previous article two things are required for doing any analysis in FxCop, they are:
· Assembly ( either a .exe or .dll)
· Rule
A brief explanation about the windows and menus in FxCop
Run FxCop by clicking , Start > All Programs > Microsoft FxCop > Microsoft FxCop 1.36
After the FxCop window was opened,
Click File > New Project.
The following Figure 1.0 shows the FxCop tool,
Fig 1.0
Panes in FxCop
There are 3 panes in the tool, they are:
· Main Pane
· Messages Pane
· Output Pane
Main Pane
Figure 1.1 shows the Main Pane,
Fig 1.1
It will have 2 tabs in it, they are
· Targets
· Rules
These two tabs serve the respective purpose of showing and managing targets and Rules in the current project.
Messages Pane
This Pane shows the messages that are generated by the FxCop tool after doing the Code analysis and it will be of various categories.
Figure 1.2 shows the Messages pane.
Fig 1.2
It will have 4 tabs in it they are,
· Active
· Exclude in Project
· Exclude in Source
· Absent
The usage of these we will see in the later articles.
Output Pane
This will show the properties in code format when an item is clicked on the Main Pane.
Figure 1.3 shows the Output Pane,
Fig 1.3
Menus
For the initial level, it is enough to know about the 3 menus in the tool. They are
1. File > New Project
It is used to create a new project.
2. Project > Add Targets
It is used to add assemblies from the Project on which you want to do the analysis.
3. Project > Analyze
To start the analysis, you need to click this or press F5 or click Analyze button on the toolbar.
A simple analysis:
1. Run FxCop.
Start > All Programs > Microsoft FxCop > Microsoft FxCop 1.36
2. File > New Project.
3. Project > Add Targets.
4. Select the desired assembly you want to analyze (it can either be a .dll or an .exe).
For example, I am selecting here a .net application (Which was downloaded from internet)
5. If you have selected multiple assemblies then select any one of them (the one you want to analyze first) and then click Project > Analyze or press F5 or Click Analyze from toolbar.
6. Analyzing with introspection Engine dialog box will appear when the analysis is under process.
7. Then it will display list of messages in the right pane.
The resultant window is what is shown in the Figure 1.0. The messages shown will be of the following categories, they are:
· Critical error
This means that it is an major issue and need to be corrected.
· Warning
This means it’s just a warning and not that much serious, but if corrected the it will be good.
More details about the messages:
Double click on the respective message, then Message Details window will appear, which gives a detailed explanation about the message along with other options.
That window will have 5 tabs in it which elaborates about he message and its dependencies.
Figure 2.0 shows the Message Details window,
Fig 2.0
Stopping the Analysis
Click the Cancel button on the Analyzing with introspection Engine dialog box to cancel the Analysis in the middle.
Viewing a summary of the Analysis
Click Project > Analysis Summary, it will display a summary of the analysis done.
Figure 2.1 shows the Analysis Summary window,
Fig 2.0
Saving the Project
After the analysis is over , save the project before saving the Message XML file otherwise it will throw an error.
Note:
Moreover save the Project file in the same directory of the Assembly for which the code analysis is done.
To save the project click,
File > Save Project.
Saving the Report
After saving the Project file, you a save the report file wherever you want.
To save the Report click,
File > Save Report
This might have given a basic idea about the usage and components of FxCop. We shall see more in the coming Chapters.
In the previous article (FxCop Part I – Introduction), we saw the basics of FxCop , its definition, download path, comparison with other Code analysis tools, a simple demo for doing a analysis,etc.
In this article (Part II -A startup lesson on using FxCop), we are going to see the usage of FxCop at a beginner’s level.
As we saw in the previous article two things are required for doing any analysis in FxCop, they are:
· Assembly ( either a .exe or .dll)
· Rule
A brief explanation about the windows and menus in FxCop
Run FxCop by clicking , Start > All Programs > Microsoft FxCop > Microsoft FxCop 1.36
After the FxCop window was opened,
Click File > New Project.
The following Figure 1.0 shows the FxCop tool,
Fig 1.0
Panes in FxCop
There are 3 panes in the tool, they are:
· Main Pane
· Messages Pane
· Output Pane
Main Pane
Figure 1.1 shows the Main Pane,
Fig 1.1
It will have 2 tabs in it, they are
· Targets
· Rules
These two tabs serve the respective purpose of showing and managing targets and Rules in the current project.
Messages Pane
This Pane shows the messages that are generated by the FxCop tool after doing the Code analysis and it will be of various categories.
Figure 1.2 shows the Messages pane.
Fig 1.2
It will have 4 tabs in it they are,
· Active
· Exclude in Project
· Exclude in Source
· Absent
The usage of these we will see in the later articles.
Output Pane
This will show the properties in code format when an item is clicked on the Main Pane.
Figure 1.3 shows the Output Pane,
Fig 1.3
Menus
For the initial level, it is enough to know about the 3 menus in the tool. They are
1. File > New Project
It is used to create a new project.
2. Project > Add Targets
It is used to add assemblies from the Project on which you want to do the analysis.
3. Project > Analyze
To start the analysis, you need to click this or press F5 or click Analyze button on the toolbar.
A simple analysis:
1. Run FxCop.
Start > All Programs > Microsoft FxCop > Microsoft FxCop 1.36
2. File > New Project.
3. Project > Add Targets.
4. Select the desired assembly you want to analyze (it can either be a .dll or an .exe).
For example, I am selecting here a .net application (Which was downloaded from internet)
5. If you have selected multiple assemblies then select any one of them (the one you want to analyze first) and then click Project > Analyze or press F5 or Click Analyze from toolbar.
6. Analyzing with introspection Engine dialog box will appear when the analysis is under process.
7. Then it will display list of messages in the right pane.
The resultant window is what is shown in the Figure 1.0. The messages shown will be of the following categories, they are:
· Critical error
This means that it is an major issue and need to be corrected.
· Warning
This means it’s just a warning and not that much serious, but if corrected the it will be good.
More details about the messages:
Double click on the respective message, then Message Details window will appear, which gives a detailed explanation about the message along with other options.
That window will have 5 tabs in it which elaborates about he message and its dependencies.
Figure 2.0 shows the Message Details window,
Fig 2.0
Stopping the Analysis
Click the Cancel button on the Analyzing with introspection Engine dialog box to cancel the Analysis in the middle.
Viewing a summary of the Analysis
Click Project > Analysis Summary, it will display a summary of the analysis done.
Figure 2.1 shows the Analysis Summary window,
Fig 2.0
Saving the Project
After the analysis is over , save the project before saving the Message XML file otherwise it will throw an error.
Note:
Moreover save the Project file in the same directory of the Assembly for which the code analysis is done.
To save the project click,
File > Save Project.
Saving the Report
After saving the Project file, you a save the report file wherever you want.
To save the Report click,
File > Save Report
This might have given a basic idea about the usage and components of FxCop. We shall see more in the coming Chapters.
Labels:
FxCop
Subscribe to:
Posts (Atom)