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

时间:2012-07-26 20:36:59

标签: .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编译它时,我收到此错误:

  

错误JS1259:引用的程序集依赖于另一个未引用或无法找到的程序集

导致此错误的原因是什么,我该如何解决?

1 个答案:

答案 0 :(得分:6)

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

代码使用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'

OR

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

import Accessibility;