簡體   English   中英

將Web服務引用添加到script#項目

[英]Adding a web service reference to a script# project

我試圖將對我在Microsoft Azure中托管的Web服務的引用添加到Script#項目中,但遇到了一些問題。

目前,我正在嘗試使其盡可能干凈,因此我正在Script#> jQuery Script庫項目中工作,僅使用自動生成的代碼。 如果右鍵單擊解決方案>添加服務引用>高級...>添加Web參考,然后進行編譯,則會收到大量的不兼容錯誤:

Error   1   The type or namespace name 'GeneratedCodeAttributeAttribute' does not exist in the namespace 'System.CodeDom.Compiler' (are you missing an assembly reference?) C:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\ScriptSharpEmAirTest\Properties\Settings.Designer.cs   15  38  ScriptSharpEmAirTest
Error   2   The type 'System.CodeDom.Compiler.GeneratedCodeAttribute' exists in both 'c:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\packages\ScriptSharp.0.7.5.1\tools\mscorlib.dll' and 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll' C:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\ScriptSharpEmAirTest\Properties\Settings.Designer.cs   15  38  ScriptSharpEmAirTest
Error   3   The type or namespace name 'GeneratedCodeAttributeAttribute' does not exist in the namespace 'System.CodeDom.Compiler' (are you missing an assembly reference?) C:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\ScriptSharpEmAirTest\Web References\net.azurewebsites.emair\Reference.cs   26  30  ScriptSharpEmAirTest
Error   4   The type 'System.CodeDom.Compiler.GeneratedCodeAttribute' exists in both 'c:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\packages\ScriptSharp.0.7.5.1\tools\mscorlib.dll' and 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll' C:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\ScriptSharpEmAirTest\Web References\net.azurewebsites.emair\Reference.cs   26  30  ScriptSharpEmAirTest
Error   5   The type or namespace name 'DebuggerStepThroughAttributeAttribute' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)    C:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\ScriptSharpEmAirTest\Web References\net.azurewebsites.emair\Reference.cs   27  25  ScriptSharpEmAirTest
Error   6   The type or namespace name 'DebuggerStepThroughAttribute' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?) C:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\ScriptSharpEmAirTest\Web References\net.azurewebsites.emair\Reference.cs   27  25  ScriptSharpEmAirTest
Error   7   The type or namespace name 'DebuggerNonUserCodeAttributeAttribute' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)    C:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\ScriptSharpEmAirTest\Properties\Settings.Designer.cs   27  37  ScriptSharpEmAirTest
Error   8   The type or namespace name 'DebuggerNonUserCodeAttribute' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?) C:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\ScriptSharpEmAirTest\Properties\Settings.Designer.cs   27  37  ScriptSharpEmAirTest
Error   9   The type or namespace name 'SendOrPostCallback' does not exist in the namespace 'System.Threading' (are you missing an assembly reference?) C:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\ScriptSharpEmAirTest\Web References\net.azurewebsites.emair\Reference.cs   33  34  ScriptSharpEmAirTest
Error   10  The type or namespace name 'SendOrPostCallback' does not exist in the namespace 'System.Threading' (are you missing an assembly reference?) C:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\ScriptSharpEmAirTest\Web References\net.azurewebsites.emair\Reference.cs   35  34  ScriptSharpEmAirTest
Error   11  The type or namespace name 'SendOrPostCallback' does not exist in the namespace 'System.Threading' (are you missing an assembly reference?) C:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\ScriptSharpEmAirTest\Web References\net.azurewebsites.emair\Reference.cs   37  34  ScriptSharpEmAirTest
Error   12  The type or namespace name 'SendOrPostCallback' does not exist in the namespace 'System.Threading' (are you missing an assembly reference?) C:\Users\Axel\Documents\Visual Studio 2012\Projects\ScriptSharpEmAirTest\ScriptSharpEmAirTest\Web References\net.azurewebsites.emair\Reference.cs   39  34  ScriptSharpEmAirTest

(實際上有158個錯誤)

顯然,在添加Web引用之前進行的編譯很順利,並且具有相同Web引用的控制台項目不會出現任何問題。

您可以向scripsharp項目添加Web引用嗎? 有沒有遵循的特定程序?

https://github.com/nikhilk/scriptsharp/issues/414#issuecomment-39080016相同的問題?

我在此處評論過,但會在此處復制,以供將來偶然發現相同問題的人使用:

...一些需要注意的內容。

腳本號與運行.net代碼無關。 它涉及使用c#語言編寫腳本應用程序,以及使用腳本環境的功能(在瀏覽器中,在node.js等中)。 這些“如何在腳本#中執行x”問題中的許多問題的答案與“如何在insert_your_script_environment中執行x”相同。

因此,如上所述,在JavaScript客戶端中,您可能會(或者也許我應該說是理想的,因為有時基於WCF的實現不是這種情況)與帶有簡單JSON的REST API的服務一起使用。 腳本#中也是如此。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM