TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dc
NA
663
0
Postbuild in C#.net
Jul 31 2011 12:43 AM
I would like the following assistance with a post-build command event in a C#.net 2008 desktop application:
1. If a post-build command event does not work, can you tell me where I would see any error messages?
2. How would you debug a post-build command event just like the way it is suppose to run? Do you use some command line prompt? The only thing I can think of is to set the project file listed in the post-build command event to the startup project, rebuild and step through the code. However when I attempt to step through the code in 'debug' mode, the application does get get the 'debug' parameter.
3. I believe the post-build command event should run since it is set to run on successful build. When I build the project file that has the following command C:\Tracbuild.exe Debug , the entire solution rebuilds successfully with a few warnings.
4. I think the Tracbuild project did not execute since I do not see the output where the Tracbuild is suppose to place output files. Do you think I may need to look at some security settting? Maybe an output folder should be created. The following is most of the code in the Tracbuild project. Could you suggest what else I could be looking for?
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using EnrollTrac.Common;
namespace TracBuild
{
class Program
{
static int Main(string[] args)
{
try
{
Console.WriteLine("Current Directory: " + Directory.GetCurrentDirectory());
try
{
Directory.Delete(Directory.GetCurrentDirectory() + "
\\output
", true);
}
catch (Exception ex)
{
Console.WriteLine("Warning while attempting delete on 'output' directory. " + ex.Message);
}
string ConfigurationName = args[0];
File.Copy("App." + ConfigurationName + ".Config", "app.Exe.Config", true);
//copy executables
File.Copy("app.exe", "app2.Exe", true);
foreach (string configfile in Directory.GetFiles(Directory.GetCurrentDirectory(), "App.*.Config"))
{
File.Delete(configfile);
}
Console.WriteLine("Executing TracBuild for " + ConfigurationName);
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
Console.Error.WriteLine(ex.StackTrace);
return 1;
}
return 0;
}
}
Reply
Answers (
1
)
C# - insert macro into word document using C#
How to find 50 days after date in c# win form