Skip to content
Ewen Wallace edited this page Jul 6, 2020 · 11 revisions

Yeah, don't. See https://github.com/CADbloke/CodeLinker/blob/master/CodeLinker2/Help.cs

This old version was too confusing so...

Deprecated

CODELINKER /?
CODELINKER [Folder [/s]]
CODELINKER [[Source.csproj] Destination.csproj]
CODELINKER new [[Source.csproj] Destination Folder]
CODELINKER new [[Source Folder] Destination Folder] [/s]
CODELINKER strip [Destination Folder [/s]]
CODELINKER strip [Destination.csproj]
CODELINKER ... /noconfirm
CODELINKER Source.csproj Destination.csproj /abs /prefix:"In This Folder"

Folder   Links the source(s) into all CSPROJ files in the folder
         This is the destination folder that has Linked projects.
         The Destination projects need to have the source in their placeholder.
Source.csproj        optional Path to the CSPROJ with the source to be Linked.
                     if only 1 CSPROJ is specified then it is the Destination.
                     This source overrides all sources in the Destination.
Destination.csproj   Path to the existing Destination project.

new      Copies the Source to the Destination path and strips the contents.
         Creates new project file(s) with a placeholder + Source.
         For Folders it copies all Projects to the same destination Folder.
         
/nosub   Don't create SubFolders for all new Projects.
         
Source Solution Root  (optional)
         The root of the solution containing the projects to Link.
         Default is the current directory. Current? Depends - see the Wiki.
Destination Solution Folder.
         The Folder Name for the Linked project(s).
         If only one Folder is specifed then it is the destination folder.

strip    Creates Linked projects from ALL existing CSPROJ in the folder.
         /s iterates all subfolders . Strips out ALL code. Adds a placeholder.
         usage: manually copy an existing CSPROJ(s). Strip it. Add a Source.
         This is like "new" but doesn't copy anything.
         Fix References, build settings etc. Build it. Rejoice.

/?       This help text.
/noconfirm   Switch. Don't ask about overwrites etc. Use in batch jobs.
             Only affects jobs when you create a new file.
/s       Switch. Iterate all subfolders. You just forgot this, right?
         You can use . for the current folder, add /s for all subfolders.
/stfu        Switch. Don't write log to the command line or Visual Studio.
             This will still write any exception summaries but not the gory details.
/abs         Switch. Write absolute paths instead of relative paths in the Destination.
             Default is to write relative paths.
/prefix:xxx  Add a folder prefix to all the link paths in the Destination.
             Default is no prefix. NO space after the colon. Use quotes if the path has spaces.
  • Wrap paths with spaces in double quotes.
  • Paths can (should!) be relative.
  • Source.csproj is optional, in which case you need to have the source project in the placeholder. So if you specify one CSPROJ file here it is the destination.

The Destination CSPROJ file needs this XML comment placeholder...

<!-- CodeLinker
Source: PathTo\NameOfProject.csproj     <== this is optional
Exclude: PathTo\FileToBeExcluded.cs     <== this is optional

Ummm, the exclude thing doesn't actually work yet. Sorry.

Include: PathTo\FileToBeIncluded.cs     <== this is optional
-->

<!-- EndCodeLinker -->
  • "new" and "strip" creates this for you.
  • You may specify multiple Source: projects. No wildcards.
  • If you don't specify a source in the command call it better be there.
  • You may specify multiple Exclude: &/or Include: items.
  • File name or path. Wildcards are OK.
  • In/Exclusions are a simple String wildcard match.
  • Exclusions override Any Inclusions.
  • If you specify no Inclusions then everything is an Inclusion.
  • Multiple Source: or Exclude: or Include: must be on separate lines.
  • Every Code ProjectLinker will re-Link the source CSPROJ into the space between the XML comment placeholders.
  • ALL code links inside these placeholders are refreshed every time. OK?

###Examples CODELINKER . /s
Refreshes all links all the projects in the current folder where CodeLinker.exe is, and all the subfolders. It looks in the destination projects for its source and logs an error if it can't find it.

CODELINKER new Folder\MySourceFolder\MySource.csproj ..\MyDestinationFolder /noconfirm
Creates a new linked destination project in the folder MyDestinationFolder which is on the same level in the folder tree as the current folder (relative paths can be tricky). The destination folde rwill be created if it doesn't already exist. The source project is added to the "Link Zone" placeholder. /noconfirm means that it will not ask you to confirm overwriting any existing files so be careful. This switch is mainly for use in .bat files. Note that you didn't specify /nosub so each new Project will be in its own folder in the destination path.

CODELINKER strip ..\MyDestinationFolder
Same folder as the previous example but it will strip all the code includes from a project you copied there using Windows Explorer etc. It will add the "Link Zone" placeholders if they don't already exist. Notice there is no /s switch so it won't recurse into subfolders in this example.

Clone this wiki locally