动态创建从源头code编译.NET的exe? [英] Dynamically create a compiled .NET exe from source code?

查看:90
本文介绍了动态创建从源头code编译.NET的exe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要注入一个自定义的,独特的,静态的字符串到我的基于.NET的EXE。对于所有意图和目的,假设这是一个PKI我的私钥。

I need to inject a custom, unique, static string into my .NET based EXE. For all intents and purposes, assume that this is my Private key of a PKI.

我对我以后怎么接近保护私钥在C#源$ C ​​$ C的一些想法,我的问题是我怎么把我的.CS文件,并创建一个基于关可执行的呢?

I have a few ideas on how I'll approach protecting the Private key within the C# source code, my question is how do I take my .CS files and create an executable based off it?

推荐答案

看看的 CSHARP codeProvider ,它基本上可以使用将含有源$ C ​​$ C字符串,并编译成一个程序集(EXE或DLL),或者您需要中,在存储器组件。

Take a look at CSharpCodeProvider, which can essentially be used take a string containing source code and compile it to an assembly (EXE or DLL), or if you require, an in memory assembly.

您也可以使用 codeDOM 为$事情C $Ç发电侧。看看发生源$ C ​​$ c和从$ C编译程序$ CDOM图为出发点。

You can also use the codeDOM for the code generation side of things. Take a look at 'Generating Source Code and Compiling a Program from a CodeDOM Graph' as a starting point.

这篇关于动态创建从源头code编译.NET的exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆