Skip to content

including in project

Simon Cahill edited this page Feb 27, 2023 · 1 revision

Including getopt.net in your project

getopt.net is available as a NuGet package, which you can include in your project.

Adding NuGet package

In Visual Studio, open the Package Manager Console and enter install-package getopt.net-bsd

Adding as submodule

If adding packages isn't your style, and you'd rather include getopt.net as a git submodule, that's fine too! (Even if I wouldn't necessarily recommend it)

1. are sure your project is a git repository.

If you're unsure whether or not your project is a git repository, open a terminal (CMD on windows) and type git status.

If the message: fatal: not a git repository (or any of the parent directories): .git shows, then your project is not a git repository.

If the error Command not found is shown, install git. Your project is (likely) not a respository. Once you've installed Git, try step 1

Making your project a git repository

Go to your project directory in the terminal and type in the command git init.
Voilá, your project is now a git repo!


2. Add a submodule directory

It's always good practice to keep your directories organised.
When adding git submodules, it's always good to keep them separate from the rest of your repository; this way you always know which are actually submodules.

In your repository, type: mkdir submodules && cd submodules.

Now in your submodule directory, choose whether you want to add my repository per HTTPS or SSH.

Adding getopt.net via https

In YourProject/submodules/

git submodule add https://github.com/SimonCahill/getopt.net.git

Adding getopt.net via ssh

In YourProject/submodules/

git submodule add ssh://git@github.com:22/SimonCahill/getopt.net.git


3. Adding getopt.net as a project reference

  1. In your solution in Visual Studio, right-click the solution and select "Add Existing Project"
  2. Select the getopt.net project
  3. Right-click your main project where getopt.net is to be used, and select References -> Add Project Reference
  4. Select the getopt.net project