Isn\'t this information necessary only in the executable\'s project?
How to disable this file creation?
NuGet 2.8
EDIT
Libr
I created a little console app that checks all the date of the app.config files and then auto deletes them from your .csproj and the file. Todo: delete from tfs. Perhaps this could help.
class Program
{
private static string RootFolder;
private static string AppConfigName;
private static bool AskConfirmation = true;
static void Main(string[] args)
{
try
{
AppConfigName = "app.config";
RootFolder = @"";
ScanDir(RootFolder);
Console.WriteLine();
Console.WriteLine("DONE!");
Console.WriteLine("Press ENTER to finish...");
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
private static void ScanDir(string directoryParent)
{
var dirs = Directory.GetDirectories(directoryParent);
foreach (var dir in dirs)
{
var dirInfo = new DirectoryInfo(dir);
if (dirInfo.Name == "bin" || dirInfo.Name == "obj" || dirInfo.Name == "debug" || dirInfo.Name == "tempPE" || dirInfo.Name == "java" || dirInfo.Name == "res") continue;
var files = Directory.GetFiles(dir, "app.config");
if (files.Length == 0)
{
ScanDir(dir);
continue;
}
Process(dir);
//ScanDir(dir);
}
}
private static void Process(string dir)
{
var fi = new FileInfo(Path.Combine(dir, AppConfigName));
if (fi.CreationTime.Date != DateTime.Now.Date) return;
if (AskConfirmation)
{
Console.WriteLine("Scan " + dir.Replace(RootFolder, ""));
Console.Write("Remove (y)es or (n)o ?");
var key = Console.ReadKey();
Console.WriteLine();
if (key.Key.ToString() =="Y")
// remove app.config
RemoveAppConfig(dir, fi);
}
else
RemoveAppConfig(dir, fi);
}
private static void RemoveAppConfig(string dir, FileInfo fi)
{
var csProjs = Directory.GetFiles(dir, "*.csproj");
foreach (var csProj in csProjs)
{
var txt = File.ReadAllText(csProj);
txt = Regex.Replace(txt," ", "",RegexOptions.IgnoreCase);
File.Delete(csProj);
File.WriteAllText(csProj, txt);
}
File.Delete(fi.FullName);
// todo: undo in tfs
Console.WriteLine("Deleted");
}
}