472,121 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,121 software developers and data experts.

removing Beta versions

My PC was a completely screwed up mess. Nieither the unistall
tool or the manual uninstall at
http://msdn.microsoft.com/vstudio/su...l/default.aspx
worked. I also tried the VS 2005 beta cleanup tool at
http://blogs.msdn.com/astebner/archi...25/411974.aspx. This
tool was designed to remove Beta 1 in preparation for Beta 2. I
needed to remove Beta 1 in preparation for VS2005 Pro, not exactly the
same thing. No matter what I did VS2005 still crashed on startup;
though I think the 3 steps: uninstall tool, manual uninstall, and VS
2005 beta cleanup tool did move me closer.

In despiration I wrote me own tool to remove anything in the GAC
whose File Version included the word "beta" That was an extension of
what the VS 2005 beta cleanup tool did. To my shock it worked!

Here is the VS2003 code to remove "beta":

private void timer1_Tick(object sender, System.EventArgs e)
{
this.timer1.Enabled=false;
// test dll file info
// FileVersionInfo info =
FileVersionInfo.GetVersionInfo(@"C:\temp\Microsoft .VisualStudio.TextManager.Interop.8.0\8.0.0.0__b03 f5f7f11d50a3a\microsoft.visualstudio.textmanager.i nterop.8.0.dll");
// fileVersion "8.0.40607.16 (beta1.040607-1600)" string

string path=Environment.GetEnvironmentVariable("Windir");
path+="\\assembly";
string [] dirs=Directory.GetDirectories(path);
foreach (string pp in dirs)
{
if (pp.Substring(pp.LastIndexOf('\\')+1,3)=="GAC")
{
string [] sdirs=Directory.GetDirectories(pp);
foreach (string spp in sdirs)
this.dirFiles(spp);
}

}
using (StreamWriter sw=new StreamWriter(@"c:\temp\delete
dirs.txt"))
foreach (string s in ddirs)
sw.WriteLine(s);
Environment.Exit(0);

}

ArrayList ddirs=new ArrayList();
public void dirFiles(string path)
{
string [] dirs=Directory.GetDirectories(path);
foreach (string dir in dirs)
dirFiles(dir);
string [] files=Directory.GetFiles(path);
bool fileDeleted=false;
foreach (string file in files)
{
string fp=file;
FileVersionInfo info =
FileVersionInfo.GetVersionInfo(fp);
if (info.FileVersion.ToLower().IndexOf("beta")>=0)
{
Trace.Assert((((TimeSpan)(System.DateTime.Now-File.GetCreationTime(fp))).Days>200),"File
too new");
File.Delete(fp);
fileDeleted=true;
}
}
files=Directory.GetFiles(path);
dirs=Directory.GetDirectories(path);
if (files.Length==0 && dirs.Length==0 && fileDeleted)
ddirs.Add(path);
}
}

Here is the VS2005 Pro code to delete empty directories from the GAC
that I ran after I got VS2005 working with the above code:


private void timer1_Tick(object sender, System.EventArgs e)
{
this.timer1.Enabled=false;
string s;
using (StreamReader sr=new StreamReader(@"c:\temp\delete
dirs.txt"))
{
while ((s=sr.ReadLine())!=null)
if (s.Length > 0)
{
if (Directory.Exists(s))
Directory.Delete(s);
string path = s.Substring(0,
s.LastIndexOf('\\') - 1);
if (Directory.Exists(path))
{
string[] files = Directory.GetFiles(path);
string[] dirs =
Directory.GetDirectories(path);
if (files.Length == 0 && dirs.Length == 0)
Directory.Delete(path);
}
}

}
Environment.Exit(0);
}


Jan 31 '06 #1
0 1286

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by juanv | last post: by
9 posts views Thread by Marek Kurowski | last post: by
5 posts views Thread by Michael C | last post: by
3 posts views Thread by Benjamin.Nitschke | last post: by
14 posts views Thread by Chuck | last post: by
reply views Thread by Jon Ripley | last post: by
5 posts views Thread by Aziz | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.