I've tried using MSBuild in another folder where I've just copied the project path as well as an instance path of MSBuild version 15, it works to compile programmatically with the main C# program using process.start on MSBuild.exe in. But this requires the source code files to be exposed, when a user uses the program to compile the other program, the user could find the source code in the main program folder. What solutions are out there?
Asked
Active
Viewed 60 times
0
-
7why do you need to compile it programmatically at all? what are you trying to achieve? that's probably important to advise on a solution; note: even native compiled C++ exes can be decompiled, so: in general, for a user to *use* a program locally: you should assume that something close to the original source is available to a suitably determined attacker – Marc Gravell Jul 05 '23 at 07:58
-
4read up on code obfuscation, BUT be aware the only real way to protect code is behind a service 'endpoint' – Mitch Wheat Jul 05 '23 at 07:58
-
Are you trying to create a [source generator](https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview) that doesn't expose the source? – Jonathan Dodds Jul 05 '23 at 13:56
-
@JonathanDodds YEs a source generator sounds right!!!! – Alexander Jansson Jul 06 '23 at 03:27