我试图将我在Microsoft Azure中托管的Web服务的引用添加到Script#项目中,并且我遇到了一些问题。
目前我尝试尽可能干净,所以我在一个脚本#> jQuery脚本库项目中工作,只有自动生成的代码。如果我右键单击解决方案>添加服务参考>高级...>添加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个错误)
显然,在添加网络参考之前进行编译顺利进行,并且具有相同网络参考的控制台项目没有任何问题。
您可以在scripsharp项目中添加网络参考吗?有没有具体的程序可以遵循?
答案 0 :(得分:0)
与https://github.com/nikhilk/scriptsharp/issues/414#issuecomment-39080016相同的问题?
我在那里评论过,但是会在这里复制,以便那些在未来遇到同样问题/问题的人:
......要记住一些上下文的内容。
脚本#不是关于运行.net代码。它关于使用c#语言 作者脚本应用程序,并使用脚本环境的功能 (在浏览器中,在node.js等)。许多这些的答案"我该怎么做 在脚本中执行x#"问题与&#34相同;我该如何做x insert_your_script_environment"
因此,如上所述,在JavaScript客户端中,您很可能(或者也许是我 应该说理想,因为基于WCF的情况并非如此 有时实现)使用简单的REST API处理服务 说JSON。这同样适用于脚本#。