which project template?

SEFL

New member
Joined
Jan 14, 2011
Messages
4
Programming Experience
5-10
Hi everyone,

Although I've been using VB.net for a few web projects over the last year and a half, I'm not overly comfortable with it yet. I come from the classic ASP realm primarily, trying to reeducate myself in things beyond just websites (where I've spent my last 12 years, self-taught).

Anyway, here's my situation. I'm trying to build my second program ever using Visual Studio.NET, having just finished my first program last week. This particular program will send out monthly bills via email to my clients in Word docs, and I'm going to install it on my server via Windows Task Scheduler.

I'm not looking for help in coding any of that stuff. What I can't figure out, as stupid as it sounds, is which template to use to get started with. I don't need to interact with the program at all, so running it as a Windows Forms application seems like something of a waste to me. I've never built a Console application before, so I don't have a clue if it's capable of something like this (although it looks like theoretically it would be.) I've never even heard of Windows Presentation Foundation before. And I'm not sure if this would work as a class library if I registered the DLL using regsvr32.

If someone could tell me where I should start, I'd appreciate it very much. Again, I'm not looking for someone to code this for me. I'm just looking to better understand which of the templates I should select. I know it's stupid, but it's the piece of knowledge I'm missing.
 
What you want is a Console Application. Every project type has full access to the .NET Framework so they can all do basically anything. The point of a Console Application is to create a Windows application without a GUI. It can still interact with the user through the console window if desired, using methods like Console.WriteLine and Console.ReadLine. If you create a Console Application without any such calls, running it directly would cause a console window to open, the would run and then the console window would close. Running that as a non-interactive user as a scheduled task would do the work without displaying anything, which is exactly what you want. Just note that it's probably a good idea to call Console.WriteLine intermittently to aid in debugging. That way you can see what the app is doing when running it in the debugger and you can also run it directly any other time and see if there are any issues.
 
Thanks, jmcilhinney. I ended up going that route (using Console.Writeline wasn't a big issue for me...I'm always Response.Writing stuff for debugging reasons under normal circumstances anyway).

So I wrote my application, published it, got everything working the way it should. But I can't figure out how to add it to the Windows Task Scheduler, since I can't figure out which file I'm supposed to link to within the scheduler. I'm thinking it's the application manifest file in the root of the installation path (in my case, called "Billing App v. 1.1.application"). Am I right or is it something else? This is the last thing I'm down to. Thanks.
 
I don't think you'll be able to use ClickOnce deployment. When you schedule a task you'll need to specify the path of the EXE, but ClickOnce apps are not installed to the file system normally. They are installed to the ClickOnce cache, so the path to the EXE is obscure and may not even be constant. You should either use a Setup project in VS (not available in VB Express) to create a Windows Installer package, or else just use XCOPY deployment, i.e. just copy the files from the output folder to the target system.
 
Well, in this case the target system is the same as the one I developed it on. It can only run on the target system since it makes use of the Word COM object. Resource isn't an issue on this system, though.

But that being the case, since there is a "Bin\Release" version, can I schedule the .EXE within the Bin\Release version to run within Task Scheduler? If not, no big deal. I only need to run it once every month anyway, so I can do it manually.

Appreciate the help, too. I know I'm asking a lot of dumb newbie questions. But hey, that's how you learn things, right?
 
It can only run on the target system since it makes use of the Word COM object.
It can run on any system that has the right version of Word installed.
can I schedule the .EXE within the Bin\Release version to run within Task Scheduler?
You can but, to me, that doesn't feel quite right. I'd probably manually create a folder under Program Files and copy the EXE and any other required files there manually.
 
Yeah, that was kind of what I meant, in an awkward-sounding sort of way (sometimes I don't explain myself very well). The only system that has the version of Word I'm using (Word 2007) is my development system. I do also have a web server, but in order to install Word, I'd have to buy a license for it, and buying a Word license just for a monthly billing program isn't justified.

I think I will go the Program Files (x86) route...I have an XP64 development box. I was already half-thinking about it anyway, and this also keeps my programs in one spot.

Anyway, I really do appreciate the help. I know I said that before, but it's not often I get this much help on anything. Way cool of you.
 
Back
Top