“windowinput”需要什么组件? C#.NET [英] What assembly do I need for "windowsinput"? C# .NET

查看:79
本文介绍了“windowinput”需要什么组件? C#.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个简单的编译器,我可以编译C#控制台应用程序..



当我尝试编译这段代码时



I have this simple compiler which where I can compile C# Console applications..

And when I try compile this code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WindowsInput;
using System.Windows.Forms;

namespace ScreenshotConsole
{
    class Program
    {


        static void Main(string[] args)
        {
            screenshot();
            Console.WriteLine("Printescreened");
            Console.ReadLine();
        }


        static void screenshot()
        {
            SendKeys.SendWait("{PRTSC}");
        }

    }
}







它抛出了这个错误






It throws me this error

The type or namespace name 'WindowsInput' could not be found (are you missing a using directive or an assembly reference?)





我是已经添加了



I've already added the

parameters.ReferencedAssemblies.Add("System.dll");





据我所知,它应该是唯一需要的dll。







编译器的源代码。





And as far as I know it should be the the only dll needed.



Source code for the compiler.

using Microsoft.CSharp;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Forms;



namespace SimpleBuilder
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// store code
    /// select what features
    /// print out textfile with all the code from the features
    /// compile that textfileContent to a exe
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        
        private void fakeMessageOne()
        {
            if(fakeMessageCheckbox.IsChecked == true)
            {
                fakeMessage1 fkmsg = new fakeMessage1();
                fkmsg.fakeMessage();
            }
        }

        private void button_Click(object sender, RoutedEventArgs e)
        {
            
            

            CSharpCodeProvider csc = new CSharpCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", frameworkTextbox.Text } });
            CompilerParameters parameters = new CompilerParameters(new[] { "mscorlib.dll", "System.Core.dll" }, outputTextbox.Text, true);
            parameters.GenerateExecutable = true;
            parameters.ReferencedAssemblies.Add("Microsoft.CSharp.dll");
            parameters.ReferencedAssemblies.Add("System.dll");
            parameters.ReferencedAssemblies.Add("System.Windows.Forms.dll");
            parameters.ReferencedAssemblies.Add("System.Management.dll");

            parameters.ReferencedAssemblies.Add("WPF\\PresentationFramework.dll");
            parameters.ReferencedAssemblies.Add("System.Xaml.dll");
            parameters.ReferencedAssemblies.Add("WPF\\WindowsBase.dll");
            parameters.ReferencedAssemblies.Add("WPF\\PresentationCore.dll");

            CompilerResults result = csc.CompileAssemblyFromSource(parameters, sourceTextbox.Text);
            if (result.Errors.HasErrors)
            {
                result.Errors.Cast<CompilerError>().ToList().ForEach(error => errorTextbox.Text += error.ErrorText + "\r\n");
            }
            else
            {
                errorTextbox.Text = "--- Build Succeeded! ---";
            }

        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Builder bldr = new Builder();
            bldr.Visible = true;
        }
    }
}





我尝试了什么:



我已经尝试阅读并询问SO但没有帮助。



What I have tried:

I've tried reading and asking on SO but no help over there.

推荐答案

您的代码表示using语句是
Your code indicates that the using statement is
using WindowsInput





乍一看,这不是一个.net库命名空间,所以唯一可以告诉你使用什么命名空间的人是编写该库的人。



快速谷歌搜索可能会让我相信你犯了一个错误并且意味着使用System.Windows.Input?



Google [ ^ ]



System.Windows.Input命名空间 [ ^ ]



如果你不是指System.Windows.Input那么我恐怕你需要和你工作的其他人或者你的图书馆的人交谈。请记住,我们无法访问您的硬件,我们无法访问您的代码,也无法读懂您的想法或了解您的项目。



这个问题非常清楚,但是你要么在命名空间中有一个类型,要么使用你的团队/项目成员决定使用的库的错误命名空间。

.

At first glance, this is not a .net library namespace so the only person who can tell you what namespace to use is whoever wrote that library.

A quick google search may lead me to believe you made a mistake and mean to use System.Windows.Input?

Google[^]

System.Windows.Input Namespace[^]

If you didn't mean System.Windows.Input then I am afraid you need to talk with other people working on your project or the person who wrote your library. Remember, we don't have access to your hard rive, we don't have access to your code nor do we read minds or know anything about your project.

This issue is pretty clear however, you either have a type in your namespace or are using the wrong namespace of a library your team/members of your project have decided to use.


你有一个使用WindowsInput;在代码顶部附近的行。 .NET Framework中没有这样的命名空间。



你真的想用这个代码做什么以及你想用什么类?
You have a "using WindowsInput;" line near the top of your code. There's no such namespace in the .NET Framework.

What are you really trying to do with this code and what classes are you trying to use?


这篇关于“windowinput”需要什么组件? C#.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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