0

I am developing an application which will be built from sources by an automated build/deployment pipeline so that each registered customer gets a custom-tailored binary with certain information hard-coded into it.

Build process will take a known .cs file and replace default values (placeholders basically) with data available to it from the build environment settings.

I am thinking of a repository-like class which instantiates a data object and fills its properties with values which would be easy for a regex (or even a simpler string replacement) to locate. Something like

public static KeyInfoDbo GetEmbeddedData() {
  KeyInfoDbo = new KeyInfoDbo {
      CompanyName = "[KeyInfo.CompanyName]";
  }
}

Are there better ideas for how to organize this data more efficiently or elegantly?

T.S.
  • 18,195
  • 11
  • 58
  • 78
Yuri Makassiouk
  • 425
  • 3
  • 16
  • 1
    Is there a reason the data has to be hard coded? – Mike Cheel Jun 01 '15 at 23:04
  • @MikeCheel, yes, there is. User-specific builds will be of no use for users other than the targeted user, which makes it impossible to use the software without buying it (and thus obtaining own custom-built version). – Yuri Makassiouk Jun 01 '15 at 23:10
  • Have a look at this: http://stackoverflow.com/questions/975355/ifdef-in-c-sharp – garryp Jun 01 '15 at 23:14
  • @garryp, that is certainly an idea! thanks! However, potentially we'd have to maintain a rather long source file with conditionals.. – Yuri Makassiouk Jun 01 '15 at 23:16
  • Resource files? Resource files with binary serialized objects in them? Also, it doesn't have to be regex-replaced. YOu can put placeholders, like @@@CompanyName@@@ and then do `Replace("@@@CompanyName@@@", "Name 1")` – T.S. Jun 02 '15 at 01:50
  • *which makes it impossible to use the software without buying it* just a note, you know this probably, but it is fairly certain that given enough time/resources (which might be way less than you'd think) such systems are circumvented with ease – stijn Jun 02 '15 at 08:00
  • @stijn, of course. Thanks for bringing it up, but we certainly weigh this possibility against our typical niche users' "profile" and price of the software. It is not meant to be bulletproof, just inconvenient enough to choose to properly subscribe. So, "impossible" in this case should be read in a context :) – Yuri Makassiouk Jun 02 '15 at 12:57

0 Answers0