Program.cs
Код: Выделить всё
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Management;
using Microsoft.CSharp;
using System.CodeDom.Compiler;
using System.Security.Cryptography.X509Certificates;
namespace EncEx
{
class AesComp
{
static void Main()
{
string codeCompile = File.ReadAllText("test.cs");
CSharpCodeProvider codeProvider = new CSharpCodeProvider();
ICodeCompiler icc = codeProvider.CreateCompiler();
string Output = "test.exe";
System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
parameters.ReferencedAssemblies.Add("System.dll");
parameters.ReferencedAssemblies.Add("System.Management.dll");
parameters.GenerateExecutable = true;
parameters.GenerateInMemory = false;
parameters.TreatWarningsAsErrors = false;
parameters.OutputAssembly = Output;
CompilerResults results = icc.CompileAssemblyFromSource(parameters, codeCompile);
}
}
}
Код: Выделить всё
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Management;
using Microsoft.CSharp;
using System.CodeDom.Compiler;
using System.Security.Cryptography.X509Certificates;
namespace Enclogs
{
class Aeslogs
{
static void Main()
{
Console.WriteLine("hello");
}
static byte[] EncryptStringToBytes_Aes(string plainText, byte[] Key, byte[] IV, string EncryptedKey)
{
if (plainText == null || plainText.Length
Подробнее здесь: [url]https://stackoverflow.com/questions/79058464/why-cant-i-compile-the-function-in-codedom[/url]