.net - 如何解决 JScript.NET 程序集引用错误 JS1259?

标签 .net compiler-errors jscript.net

我从 book 复制了这个小应用程序:

import System;
import System.Drawing;
import System.Windows.Forms;

public class BasicForm extends Form 
{
    public function BasicForm()
    {
        InitializeComponent();
    }
    private function InitializeComponent() : void 
    {
        this.Text = "Basic Windows Forms";
        this.Height = 400;
        this.Width = 500;
        this.WindowState = FormWindowState.Normal;
        this.StartPosition = FormStartPosition.CenterScreen;
    }
    public STAThreadAttribute() static function Main(Args:String[]) : void 
    {
        Application.Run(new BasicForm());
    }
}

BasicForm.Main(Environment.GetCommandLineArgs());

当我尝试用 jsc 编译它时,我得到了这个错误:

error JS1259: A referenced assembly depends on another assembly that is not referenced or could not be found

是什么导致了这个错误,我该如何解决?

最佳答案

导入“辅助功能”命名空间。

代码编译时使用 jsc.exe v2.0.50727 和 v4.0.30319 可访问性命名空间已导入。

没有它,编译器会生成以下内容:

Microsoft (R) JScript Compiler version 8.00.50727
for Microsoft (R) .NET Framework version 2.0.50727
Copyright (C) Microsoft Corporation 1996-2005. All rights reserved.

error JS1259: A referenced assembly requires you to also reference 'Accessibility, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Microsoft (R) JScript Compiler version 10.00.30319
for Microsoft (R) .NET Framework version 4.0.30319
Copyright (C) Microsoft Corporation. All rights reserved.

error JS1259: A referenced assembly depends on another assembly that is not referenced or could not be found

导入辅助功能;

关于.net - 如何解决 JScript.NET 程序集引用错误 JS1259?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11677633/

相关文章:

c# - 在 C# 中的 Web 服务上填充任何元素

c - 编译 Lua 时未解析的外部符号 _LoadLibraryExA

c++ - 尝试在另一个类的头文件中使用对象,出现 “redefinition of class”错误

c# - .NET 标准、.NET 核心、PCL

c# - 当发生某些 WPF 数据绑定(bind)更新时,有什么方法可以获取事件?

c++ - 我收到错误 : "in function main: undefined reference to Fraction::Fraction()"

.net - 包含 Fiddler 的 CustomRules.js 中的持久存储

c# - ListView 以编程方式添加的列显示项目类型

.net - JScript.NET 设计 IDE

c# - 用于扩展方法的 WCF 命名约定