Search Issue when using Visual Studio 2003 on Windows Vista Operating system

A couple of days ago, I faced a small issue when I tried to search specific value inside VS 2003 solutions while I have MS Windows Vista OS installed on my PC…. Doing searching will cause VS 2003 to be hanged and stop responding.. I overcome this issue by Disable Visual Themes for VS 2003.. To do so please follow the following steps:

  1. Right click on VS 2003 shortcut

  2. On compatibility tab , make sure to check "Disable Visual Themes" check box

  3. Click on OK button..

Now , You can enjoy Searching your VS 2003 solution.

How to solve XML configuration problem when you use unit testing

One of the first challenges I faced when I decided to use Unit Testing projects to test my Methods/Classes, is how to use XML configuration files with unit testing projects…

Basically the issue appear because my project using XML file as configuration file. And when I compile my Unite testing project, the compiler will copy only DLLs related to project being tested with no other resources including the configuration file(s) … this will cause all of my unit test methods to be failed because there is no configuration file available for Unit Test Project.

The solution is pretty easy… all what you have to do is to add the following attribute to Test Method header. This attribute will tell compiler to copy the file into Bin folder and things will go smooth.

[TestMethod(),DeploymentItem("XmlConfigurationFileName.XML")]

public void TestMethodName()

{

         //Method body goes here….

}

Design Patterns

What is Design Pattern:

Design Pattern: Is a general reusable solution to a commonly occurring problem in software.

Design Patten is a description or template of how to solve the problem we usually face during software development life cycle. It is showing relationship between classes without specifying how the final application will looks like. It is usually show the overall pattern that followed by the entire application/system.

Benefits of using Design Patterns:

  • It is proven solution to solve issues related to Software Development, and it facilitates thedevelopment of higly cohesive modules with minimal coupling .
  • Making the overall system easier to understand and maintain.
  • Making the communication between designers more efficient. Software professionals immediately understand the design when referring to the name of the design pattern used to solve the issue during discussing  system design

Design Patterns Categories:

Creational Design Patterns:

Structural Design Patterns:

Behavioral Design Patterns:

Test Run deployment issue: The location of the file or directory is not trusted… Error Message

Today I faced small problem while I am building Unit testing project to test my class library. in my class library I was using a DLL file located on a shared folder on my company’s network.. when I tried to run the test project I got this error message:
Test Run deployment issue: The location of the file or directory is not trusted

the solution of this issue was about adding the network path to my trusted sites.. to do so I followed the following steps:

1) open "Microsoft .NET Framework 2.0 Configuration" from administrative Tools
2) Go to "Runtime security Policy" –> Machine –> Code Groups –> All Code
3) right click –> New .. then give a name and description for the new group –> click Next
4) in the new form choose "URL" and then type your Network path. you can type it in 2 ways:

a) Y:\* –> for the whole folder
b) y:\AssemblyName.dll –> for single DLL

5) Choose Next… and then choose "Full trust"
6) click Next and then finished
7) finally close you VS and reopen it again
8) have fun in using unit testing 🙂

Thanks Microsoft for such a nice integration between tools:)

How to know the physical path of executing .Net assembly

In some cases you may come to a point where you want to know the physical path on your hard drive for the current assembly.. For example you might want to know the physical path of an Configuration XML file, which you already know that this file should be located on the same folder as the your assemblies. The following pecice of code show how u can know the path of your executing assembly

string executingAssemblyPath = “”;

FileInfo file = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);

executingAssemblyPath = file.DirectoryName;

Develop .Net 1.1 Web Application on windows Vista (IIS 7)

To develop Web application using .Net 1.1 and Visual Studio 2003 on Vista OS (IIS 7), follow the below steps:

  •   First of all you have to install Visual Studio 2003. this will install .Net 1.1 also

  •   Install all service packs for .Net framwork 1.1.

  •   Open the IIS Manager and navigate to the server root. (Not a website root, above that – the machine name.) and double click on "ISAPI and CGI restrictions."

  •   Add the v1.1 aspnet_isapi.dll to "Allowed" restrictions

                  (it’ll be at %WinDir%\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll)

  •   Navigate to the website root in IIS manager and double-click "ISAPI Filters."

  •   Add the ASP.NET 1.1 ISAPI filter from %WinDir%\Microsoft.NET\Framework\v1.1.4322\aspnet_filter.dll

  •   Go to the website root again in IIS manager and loo at "Advanced Settings."

  •   Ensure the website is using an ASP.NET 1.1 Application Pool (Vista created one for me when I installed .NET 1.1 – you may need to create one yourself.)

    Done.. Now you can develop and debug .Net 1.1 Web Applications on Vista OS and IIS 7.0