Reputation: 3904
I'd like to compile my source (or a part of it) by one of my webservers (like some websites offer nightly builds of their program). As I want my program to be customized by a third party and they have their own standalone application with say their logo and some custom strings in it. My preferable solution would be a dll file which would be loaded into my application, so I can still update the main application while retaining the customization by the third party.
So, the third party goes to my website, enters some fields and a dll file is generated (or do you have any other better way to do this?) and the dll file will be included by the application, which will grab the logo resource and some strings from it, to show in the application.
How can this be done? I'd rather to use Linux to build it, but if Windows is easier then that's not a problem either.
Upvotes: 1
Views: 162
Reputation: 9670
How about this
Build a web interface to capture the third party's customisations into, say, a database.
Set up a Continuous Integration server to manage automated builds (for example Jenkins).
Then implement custom build steps in your CI solution to grab the customisations, drop them into copies of the source code, and have your CI do a build for each client - publishing the build artefacts somewhere where the client can see them (say, somewhere within the web interface)
You could set up custom triggers in your CI server to watch the database for new customisations. Or to be triggered by some operation in the web UI.
Upvotes: 0
Reputation: 4652
If you trust your third party vendor try to use Team City by JetBrains, commiting some changes in svn repo folder, will cause recompilation of project and you will get precompiled project.
Upvotes: 0
Reputation: 65516
It's easy on either platform. Just accept the data into a template C# file (String.Replace will work fine). And then just shell out to the compiler.
Upvotes: 0
Reputation: 3804
You can use the CSharpCodeProvider API for that, here is an example:
var csc = new CSharpCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", "v3.5" } });
var parameters = new CompilerParameters(new[] { "mscorlib.dll", "System.Core.dll" }, "foo.exe", true);
parameters.GenerateExecutable = true;
CompilerResults results = csc.CompileAssemblyFromSource(parameters,
@"using System.Linq;
class Program {
public static void Main(string[] args) {
var q = from i in Enumerable.Rnge(1,100)
where i % 2 == 0
select i;
}
}");
results.Errors.Cast<CompilerError>().ToList().ForEach(error => Console.WriteLine(error.ErrorText));
If you want to use linux take a look at Mono MCS C# Compiler
Upvotes: 1