I have a C# 2010 console application that calls a web service where I am having a problem. The line of code that is commented out for the strConsoleAppLocation string field works correctly when I run the application from my workstation. However when the application is deployed the line of code that refers to strConsoleAppLocation path is changed, I get an error on the line of code, " Process1.StartInfo.Arguments = Process_Arguments;".

When the application is deployed, I make certain the executable is located in the directory path: \\server1\\DEV\\Ftest\\Esample.exe.

Due to what I mentioned above, I have the following questions:
1. Can you tell me what to do to resolve this issue for now?
2. When this application goes to production, can you tell me and/or point me to a reference to display the preferred method
of how the Esample.exe executable should be called?

I think what you ate trying to do is execute an app on a remote system. Even if your code succeeds, the executable will run locally as a local process. This code must be executed on the server to start your web service, not on the client. You can probably put this as a startup item on the server.

I know this is not a clear question, but this is the situation. I have a windows application which parse some file( i use TPL here).

If i minimize this application and keep idle for more than 30 minutes, then i cannot bring the application back. I can see the minimized icon, but this wont come back even if i do ALT-TAB. This is in windows 7.

I just told about file parsing, but this behavior may not be related to that. Below is another strange behavior i am seeing.

This is happening only sometimes, which may/may not related to our issue.

Say i have opened any popup window or some applications ( like MS word, IE) from my main form. When I close that popup window/app then the main form will be minimized or some other app will come front. So i had to click the app icon from task bar to bring it back

Personally, I'd probably make a validation method that operates on one string at a time and then validate and set the errorprovider directly for each TextBox one at a time. (Despite what I showed above, I wouldn't pass the actual TextBox references around. The method should validate the string, possibly returning an error message. The caller (form) passes the .Text and reports the error appropriately.)

This code well search for all text box in your form and validated it, and it will be better If you Use Tag for Description of Textbox so the user know what he is missing, Plus you avoid typing in the MessageBox something like "No Name" , No Phone" , etc ...

More Over you can tell which TextBox in the form is needed to be validate by checking that Tag if it's Empty or not.

What I want to do is when the file has changed, I need to read the file and find specific text and change it and save the file.

I've attempted the file system watcher with little luck. The problem is it is firing before the file is unlocked. I have also tried to put a method in there to check if the file was locked which basically opens the file and on exception returns true if locked otherwise false.

You should log all exceptions; I'm betting that your WriteFile is causing the new exception, which would throw something "unhandled". So, wrap that in a try-construction too, or move it somewhere else.

I'd also recommend using a using block, as opposed to a try-finally with explicit dispose - it's a bit more readable.

The using statement removes the need to explicitly close the stream, and the lock/Monitor elements help to pause the next call to WriteFile for 200 milliseconds. Without this, you have a tight loop in there with execution of WriteFile happening immediately on failure.

Indeed, but I'm only working with the OPs original code - yes, if it were my code, I'd add in terminating conditions. As I don't know what the OPs ultimate use case is here, I'm loathe to suggest this - I've just had to assume that the lock has a finite limit.

Use the FileSystemWatcher, when it notifies you of a change put an entry on a queue with a retrieval time of 1 second (or 200ms or whatever is appropriate in the future), and have another thread which pulls things off that queue at the right time and actions them. In this case the action is 'read file, find text, replace, write file'. If it fails, re-queue it.

Anyways let me explain. I'm setting up a multi-tenant quickbooks environment. The problem is as we probably all know is it wasn't really designed for multi-tenancy. Now everything works fine with what I have except the username is populated on a program level.

So in the ProgramData directory (All Users) there is a qbw.ini file that contains LASTUSERNAME=. Each time a user launches quickbooks it reads this information and prepopulated the username field for the company database login.

I don't want people seeing other peoples logins. Most just use Admin which isn't a big deal but some use their company name. So I don't want another company seeing that.

So my idea is to monitor that file for updates using a file system watcher and changing that value in the INI file to blank. So basically changing something like this: "LASTUSERNAME=Admin" to this: "LASTUSERNAME="

Quickbooks does not place a permanent lock on this file. So we don't have to worry about quickbooks locking it for a long period of time.

I'm trying suggestions as we speak. I'm adding an error count to stop the service if an exception happens so many times within a specific time period. Hopefully this will stop an overflow exception like you were talking about. I can make something to restart the service ever so often.

I have a C# 2010 console application where I need to create a setup and deployment project for it. I do not have the setup and deployment projects in the visual studio.net 2010 application I am using. I need to find the install templates.

Can you tell me where I can find the setup and deployment project install templates so I can add them to my solution ide to work with?

I want to keep some of my classes in library files and load them during runtime. I can load the assemblies and everything works fine. However, I don't find any function that will close or unload the assembly after a method is done using the assembly.

If the function is called several times, the assembly loading will be done multiple times. Without any function to unload it, can it cause any problem in application some times?

I'm now beginning the project so I would like to know the right approach and follow it. I would like to know before I start my project as I do not want to face any problems in the middle of the project. Please help and thanks in advance.

If the function is called several times, the assembly loading will be done multiple times.

Why? Just add in a boolean that's set when it's loaded the first time, and check it before you load the assembly. That way the logic is executed only once, eliminating the need to know how often the assembly is in memory.

FWIW; it's loaded into memory once, and remains there. There's no unloading, unless you put everything in a separate AppDomain.