Tuesday, July 18, 2006

External Tool for VS(Visual Studio)2003 to change the file attributes

Hi All: This Article describes adding your own tool to VS 2003
If you intigrate VS 2003 with VSS, as and when u get the latest version the respective file(s) become "Read Only". So when ever u want to edit the file, u have to check out the file, else if u want to make changes locally, u have to dig till that file using Win Explorer and have to uncheck the Read only attribute. Imagine if the project is having many subdirectories, then its bit difficult to change the read only attribute of the file(s) by navigating thru explorer.
If there is any way that address the above task, directly from VS IDE that will difinitely help us. Here is a way out. I just added a external tool, that appears under Tools menu.

U have to write a class that acceppts a file_path as argument. And u have to change teh file attributes thru code.Here i wrote a class that exactly do the same stuff.

using System;
using System.IO;
using System.Text;

namespace Surendra.ExternalTools.SetFileAttributes
public class ChangeFileAccessAttributes
public static void Main(string[] args)
string strFilePath = args[0].ToString();

File.SetAttributes(strFilePath, FileAttributes.Archive);

Creation of EXE:
Now u have to create an EXE for the above class. u can achieve teh same through CMD as below.

"C:\Surendra\PersonalProjects\ExternalTools>csc ChangeFileAccessAttributes.cs"

Integration of the tool to VS IDE:

step1: Open MS VS. Click on Tools Main Menu, then click on External tool..
A pop up will open for u.

Step 2:Click on Add button.
just fill out the text boxes as
Title: Remove Read Only
Command: Path of the ChangeFileAccessAttributes.exe
Arguements: "$(ItemPath)"
And finally press OK button..
Thats it.. your new tool will get ready and that appears under Tools menu as shown below.


Ravi said...

Good one. Better if you can explain with some screenshots.

Surendra said...

Thanks ravi:
I added required screenshots.

Anonymous said...

Greets to the webmaster of this wonderful site! Keep up the good work. Thanks.

Anonymous said...

If you are eq2 plat looking buy ffxi gil as well as FFXI Gil WOW Power final fantasy gil Leveling lotro gold and World Of eve isk When you aoc gold need lineage 2 adena someone FFXI Gil to Maple Story mesos listen,world of warcraft gold I'll be 2moon dil there.lord of the rings gold When world of warcraft power leveling you world of warcraft power leveling need Guild Wars Gold a hug,final fantasy gil I'll be age of conan gold there.

Anonymous said...

hereof lifeboat mcdole mettler sachdevait tipharma mensingwerum shilpa constable katz here
servimundos melifermuly

Anonymous said...

dgeneric pirmuhani converting ripping felt benefited severally thelwall profilewhat technical asserting
servimundos melifermuly