2012-07-26 52 views
1

我有這個小的應用程序從一個book複製:如何解決JScript.NET程序集引用錯誤JS1259?

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

是什麼造成這個錯誤,我怎麼能解決它?

回答

6

導入「Accessibility」命名空間。

當 導入輔助功能名稱空間時,使用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;

相關問題