0
I am developing an application, and I need to return the paths of files that have same name and same extension from within a specific folder, to assign a version there are them, but I do not know any method to base.
Basically, I would have to search the project’s base folder for the files named Assemblyinfo.Cs, and throw these paths into an array, but I don’t know how to query.
Resolved by : star
var files = Directory.GetFiles("C://caminho_de_amostra", "AssemblyInfo.cs", SearchOption.AllDirectories);
//Pesquisa no caminho atribuido o nome "Assemblyinfo.cs"
for (int h = 0; h < files.Length; h++)
{
Console.WriteLine(files[h]);// Apenas para ter um texto mostrando qual arquivo foi modificado
File.WriteAllLines(files[h], File.ReadAllLines(files[h]).Select(s => !s.Trim().StartsWith("[assembly: AssemblyFileVersion(") ? s : string.Join(".", s.Trim(']').Trim(')').Trim('"').Split('.').Select((n, i) => i != 3 ? n : !int.TryParse(n, out num) ? n : (anum))) + "\")]"));
}// Modifica a versão arquivo por arquivo.
Well, the algorithm involves doing a recursive search of files inside a folder, then comparing names, etc... Which step do you doubt? The question needs to be more specific.
– dcastro
Well, I doubt the research step.
– João Paulo Pulga
I edited the title of the question to better reflect doubt.
– dcastro