Почему я не могу скомпилировать функцию в CodeDOM?C#

Место общения программистов C#
Anonymous
Почему я не могу скомпилировать функцию в CodeDOM?

Сообщение Anonymous »

После получения необходимой информации из базы данных я компилирую файл, служащий для шифрования aes.
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);
}
}
}
test.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 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]

Вернуться в «C#»