DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: My entry: A .NET Console Program Generator  (Read 10,742 times)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
My entry: A .NET Console Program Generator
« on: September 18, 2018, 01:19 AM »
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.PNG

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.

Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

« Last Edit: September 18, 2018, 01:17 PM by kyrathaba »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,649
    • Participated in NANY Challenge Eleven Times
    • Coding Snacks
    • Linux User
    • Hardware Hacker
Re: My entry
« Reply #1 on: September 18, 2018, 06: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.
/Ton
Ath's software collection, Quote: "A problem well stated is a problem half-solved." (Charles Kettering)
« Last Edit: September 18, 2018, 05:30 PM by Ath »

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
Re: My entry
« Reply #2 on: September 18, 2018, 11: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.
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

Original address: https://www.donationcoder.com/forum/index.php?topic=46408.0