class Program { static string path = "C:\\Work\\6.70_Extensions\\NightlyBuild\\"; static void Main(string[] args) { var di = new DirectoryInfo("C:\\Work\\6.70_Extensions\\NightlyBuild"); foreach (var file in di.GetFiles("*", SearchOption.AllDirectories)) file.Attributes &= ~FileAttributes.ReadOnly; var files = Directory.GetDirectories(path, "SASE Lab Tools.*"); foreach(var file in files) Console.WriteLine(file); foreach(var file in files.OrderByDescending(x=>x).Skip(7)) Console.WriteLine(file); foreach(var file in files.OrderByDescending(x=>x).Skip(7)) Directory.Delete(file); } }
This is my code that I executed in VS2008.net version 3.5. However, when I transfer this to another machine with .net version 3.0, an error occurred even in the same environment.
Error:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
I do not have VS2008 installed on this machine, and I was wondering if my code has anything to do with this error? I tried switching to msdn and exploring the Directory.GetDirectories directory (string, Searchpattern) and only this appeared for 3.5
source share