I
imughal
Guest
Hi,
i am developing console application which read excel file save processing data into text file, application work file when i publish and create setup file, while running setup/installation of application getting following error:
following is code:
public void DeleteProductsListItems()
{
try
{
if (!System.IO.File.Exists($"E:\\MyLogFile\\" + "log_"+DateTime.Now.ToString("MM_dd_yyyy")+ ".txt"))
{
var myFile = System.IO.File.Create($"E:\\MyLogFile\\" + "log_"+DateTime.Now.ToString("MM_dd_yyyy")+ ".txt");
myFile.Close();
Thread.Sleep(1000);
}
using (var stream = System.IO.File.Open($"E:\\MyLogFile\\" + "log_" + DateTime.Now.ToString("MM_dd_yyyy") + ".txt", FileMode.Open, FileAccess.Write, FileShare.Read))
{
System.IO.File.AppendAllText($"E:\\MyLogFile\\" + "log_" + DateTime.Now.ToString("MM_dd_yyyy") + ".txt", "Start deleting Products SP List: Date:" + DateTime.Now.ToLongDateString() + "||" + DateTime.Now.ToLongTimeString() + "" + Environment.NewLine);
}
System.IO.File.AppendAllText($"E:\\MyLogFile\\" + "log_"+DateTime.Now.ToString("MM_dd_yyyy")+ ".txt", "Deletion has been : Date:" + DateTime.Now.ToLongDateString() + "||" + DateTime.Now.ToLongTimeString() + "" + Environment.NewLine);
}
catch (Exception ex)
{
System.IO.File.AppendAllText($"E:\\MyLogFile\\" + "log_"+DateTime.Now.ToString("MM_dd_yyyy") + ".txt", "Error Has been occurs while deleting Product List:" + ex + "" + Environment.NewLine);
}
}
pls guide what could be an issue and how to fix it.Thx
iffi
Continue reading...
i am developing console application which read excel file save processing data into text file, application work file when i publish and create setup file, while running setup/installation of application getting following error:
following is code:
public void DeleteProductsListItems()
{
try
{
if (!System.IO.File.Exists($"E:\\MyLogFile\\" + "log_"+DateTime.Now.ToString("MM_dd_yyyy")+ ".txt"))
{
var myFile = System.IO.File.Create($"E:\\MyLogFile\\" + "log_"+DateTime.Now.ToString("MM_dd_yyyy")+ ".txt");
myFile.Close();
Thread.Sleep(1000);
}
using (var stream = System.IO.File.Open($"E:\\MyLogFile\\" + "log_" + DateTime.Now.ToString("MM_dd_yyyy") + ".txt", FileMode.Open, FileAccess.Write, FileShare.Read))
{
System.IO.File.AppendAllText($"E:\\MyLogFile\\" + "log_" + DateTime.Now.ToString("MM_dd_yyyy") + ".txt", "Start deleting Products SP List: Date:" + DateTime.Now.ToLongDateString() + "||" + DateTime.Now.ToLongTimeString() + "" + Environment.NewLine);
}
System.IO.File.AppendAllText($"E:\\MyLogFile\\" + "log_"+DateTime.Now.ToString("MM_dd_yyyy")+ ".txt", "Deletion has been : Date:" + DateTime.Now.ToLongDateString() + "||" + DateTime.Now.ToLongTimeString() + "" + Environment.NewLine);
}
catch (Exception ex)
{
System.IO.File.AppendAllText($"E:\\MyLogFile\\" + "log_"+DateTime.Now.ToString("MM_dd_yyyy") + ".txt", "Error Has been occurs while deleting Product List:" + ex + "" + Environment.NewLine);
}
}
pls guide what could be an issue and how to fix it.Thx
iffi
Continue reading...