7

Sorry if this is not the right place to post this type of question...if it's supposed to be on another site please let me know or feel free to close.

I've got a simple question about github. I am very new to it and "forked" a project I wanted to contribute to.

I then cloned it locally and "ls"ed into it to look at it. I noticed the .cs files had an additional .pp extension, what is the purpose of that? So instead of Agent.cs its Agent.cs.pp.

Also how do projects like this one handle the .net side. I mean I see the html files and the .js files. But the .net (cs files) don't include a project or solution associated with them. They just come in the form of .cs.pp. If I wanted to modify these files, should I be creating a new project and adding these to my project?

Sorry for the github newbie question but I'm fairly new to it although I do use Subversion.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
JonH
  • 32,732
  • 12
  • 87
  • 145

1 Answers1

9

The C# source file is pre-processed (pp) for NuGet. See Configuration and source code transformation (NuGet).

You specify a source code transformation by including Visual Studio project properties in the code. The properties are delimited using dollar signs ($).

When adding the code from NuGet to a VS project, it will replace those properties, thus generating compilable code.

In the LSCK example you provided, the result after adding the NuGet reference is:

LSCK in Solution Explorer

Comparing the files on Github to the local ones, you'll find that .cs.pp has been converted to .csand $rootnamespace$ within the code got replaced by the namespace of the project.

To contribute, you can create such files yourself: the opposite way (.cs --> .cs.pp) can be achieved using NuGetContentGenerator.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
  • Guess, I'm not sure where to go from here, does this mean if I wanted to edit the .cs.pp files I need to make them .cs files? – JonH Jun 03 '15 at 13:35
  • If you want to maintain the project (that's possibly the reason why you forked it), the files should remain .cs.pp. If you want to use the project only (no need to fork it then), add the NuGet reference to a new Visual Studio project. If you want both and test your local changes, I'm not an expert, but a local NuGet server might help (http://stackoverflow.com/questions/14527615/can-i-publish-a-private-nuget-package) – Thomas Weller Jun 03 '15 at 13:39
  • Actually I'm an idiot, these files are found within the demo folder, there I could see the actual files as .cs. – JonH Jun 03 '15 at 17:03