topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 1:42 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: My entry: A .NET Console Program Generator  (Read 7405 times)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
My entry: A .NET Console Program Generator
« on: September 17, 2018, 08:19 PM »
I had so much going on that I wasn't able to participate in NANY 2018, so I'm getting this app in extra early, for NANY 2019.

Purpose: The cpg.exe program is a Windows command-line program that I developed because for several weeks now I've been writing a series of C# Console Programming tutorials on my local DokuWiki. Over the weeks, I've developed a pair of libraries, ioLibrary.cs and stringLibrary.cs, that I use frequently, almost with every new console program I create to illustrate a concept or test a new method. It became laborious  copying the two libraries' response files to the new program's directory each time, creating a custom response file for the new program itself, and creating a batch file to call all three three response files against the csc.exe command line compiler. Thus cpg.exe was created to automate all of that.

It's very handy for me, personally. If anyone would like, I can further develop it so that it is library-agnostic and creates the simplest possible console program.

Target Audience: C# console programmers.

Unzip the download, and place folder csdev at the root of C:\. Open an elevated command prompt in the same directory (or open the elevated prompt and navigate to cpg.exe).
cpg.exe is located in the /tools/ subdirectory. Run cpg.exe (stands for console program generator) and it will show you the use of its command-line syntax. Requires .NET Runtime.

Basically, the app is a Console Program Generator (hence, cpg.exe). When you run it and supply a path/to/desired/directory/mypreferredfilename
as a argument, it will create a C# console source code file at the specified location and will compile it.

Here's a screen shot of an executing test console app generated by cpg.exe:

cpg.PNGMy entry: A .NET Console Program Generator

The download should be extracted to your root drive on a Windows PC, i.e., C:\

That's where you should locate the /csdev/ folder after unzipping. Hey, I didn't know when I started this that I'd be sharing it,
so it's not very flexible as I coded it for my own use.

Currently, the program copies a couple of DLL libraries I wrote to the new source code file's directory. The library source code is included in the download. Also, when cpg.exe writes the source
to c:\what\ever\path\filename, it inserts the relevant using statements (equivalent of C++ includes), creates needed response files,and generates a batch file to make repetitive command line builds fast. The cpg program itself has had ioLib.dll and strLib.dll merged with its own assembly via ILMerge tool.

« Last Edit: September 18, 2018, 08:17 AM by kyrathaba »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
Re: My entry
« Reply #1 on: September 18, 2018, 01:45 AM »
You have explained how to use it, but what's the purpose of this tool? I'm not gettin' it yet... :huh:
Solved.
« Last Edit: September 18, 2018, 12:30 PM by Ath »

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
Re: My entry
« Reply #2 on: September 18, 2018, 06:30 AM »
Thanks, Ath. I wasn't as alert as I should've been when I made the OP. I've added the app's purpose to the OP.