草庐IT

smart-compile

全部标签

c# - Visual Studio 变得疯狂 : 'The directory name is invalid' error when trying to compile

出于一些非常奇怪的原因,我的VisualStudio2008在尝试编译C#项目时尝试将可执行文件的输出写入与可执行文件同名的目录,至少看起来这就是错误所在消息暗示。在我的任何项目上运行编译后,CSC.EXE报告以下编译器错误:Couldnotwritetooutputfile'D:\Projects\Examples\StringBuilderVsString\obj\Release\StringBuilderVsString.exe'--'Thedirectorynameisinvalid.'当我查看obj\Release或obj\Debug时,所有中间资源(如StringBuild

c# - 当我尝试重命名方法时,为什么 Visual Studio 告诉我有 "compiler generated references"?

我有一个名为FormattedJoin()的方法在名为ArrayUtil的实用程序类中.我尝试重命名FormattedJoin()只是Join()因为它的行为类似于.NET的string.Join()所以我认为使用相同的名称是有意义的。但是,当我尝试使用VisualStudio重命名该方法时,我收到此警告:Thismembermayhavecompilergeneratedreferenceswiththesamename.Refactoringthememberwillnotupdatethesereferences,whichmayintroducesemanticchangesa

c# - "Edits were made which cannot be compiled"。在 vs2010 中选中零错误和启用并编辑并继续

我能够在Debug模式下编辑我的代码,但随后弹出显示错误Editsweremadewhichcannotbecompiled.Executioncannotcontinueuntilthecompileerrorsarefixed但错误列表为空,我已选中启用编辑并继续。我使用的是vs2010。清理重启也没有解决问题。 最佳答案 当您的工作区损坏时,可能会出现此问题。只需关闭VisualStudio,删除(或者最好先重命名).vs文件夹,然后再次启动VisualStudio。它甚至可以在VS2017中发生。

c# - 接口(interface)继承多个接口(interface) : how is this handled by a C# compiler?

最近我发现C#允许Aninterfacecaninheritfromoneormorebaseinterfaces.例如,Caliburn.Micro中的IScreen在http://caliburnmicro.codeplex.com/SourceControl/latest#src/Caliburn.Micro/IScreen.cs中执行此操作namespaceCaliburn.Micro{publicinterfaceIScreen:IHaveDisplayName,IActivate,IDeactivate,IGuardClose,INotifyPropertyChangedE

c# - 如何修复 'compiler error - cannot convert from method group to System.Delegate' ?

publicMainWindow(){CommandManager.AddExecutedHandler(this,ExecuteHandler);}voidExecuteHandler(objectsender,ExecutedRoutedEventArgse){}错误1​​参数2:无法从“方法组”转换为“System.Delegate” 最佳答案 我猜有多个具有不同签名的ExecuteHandler。只需将您的处理程序转换为您想要的版本:CommandManager.AddExecuteHandler(this,(Action)

c# - VS 2008 Professional,Smart Device .NET C# 项目 - 构建缓慢

我有VS2008Professional和一个智能设备.NETC#项目。我总共有~100个cs文件。构建需要很长时间,我必须等待链接器大约。每次编译项目时1分钟(60秒)。我有Corei3、4GBRAM、7200rpm磁盘。是什么原因造成的,我该如何优化构建?任何VisualStudio选项? 最佳答案 如果您遵循HansPassant的评论中的建议并将MSBuild设置为诊断输出,它将更清楚地说明什么正在花费时间。如果您发现您的构建在许可编译器(LC.exe)上挂起,那么这可能是因为它试图调用服务器并超时。您可以通过更改您的mac

c# - 协变/逆变 : how to make the following code compile

更新:以下代码仅在C#4.0(VisualStudio2010)中有意义看来我对协变/逆变有一些误解。谁能告诉我为什么以下代码无法编译?publicclassTestOne{publicIEnumerableMethod(IEnumerablevalues)whereTDerived:TBase{returnvalues;}}编译时:(!!!)publicinterfaceIBase{}publicinterfaceIDerived:IBase{}publicclassTestTwo{publicIEnumerableMethod(IEnumerablevalues){returnva

c# - UInt64 和 "The operation overflows at compile time in checked mode"- CS0220

这感觉像是一个愚蠢的问题,但我似乎看不到答案。我有一个UInt64,它的最大值应该是UInt64.MaxValue18446744073709551615但是,当我尝试分配一个中等大小的数字时,出现“在检查模式下编译时操作溢出”的溢出错误。如果我将它包装在一个“未经检查”的block中,那么它会编译并运行,就像这个变量为零一样:UInt64value1=1073741824*8;//CompileerrorCS0220UInt64value2=8589934592;//Actualvalue-noerror为什么会这样? 最佳答案

javascript - mustache.js 中 compile()、parse() 和 render() 之间的区别

有什么区别:Mustache.compile(),Mustache.parse(),和Mustache.render()在新mustache.js0.5.0版,也许为了加分,您可以告诉我们解析和编译之间的一般区别是什么。 最佳答案 编辑用APIchangeintroducedinversion0.8.0,compile()方法已集成到parse()中。不再需要手动编译模板。Mustache.parse()从语法上解析模板并从中创建一个JavaScript函数体(一个字符串)。在此过程中,它会通知模板中遇到的任何语法错误。Mustac

javascript - 如何将 language_in 或 jscomp_off 与 Google Closure Compiler Service API 一起使用

是否可以通过某种方式将命令行标志(如--language_in=ECMASCRIPT5或--jscomp_off=internetExplorerChecks传递给GoogleClosureCompilerServiceAPI?我在ServiceAPIReference中找不到它.作为引用,jscomp_off记录在Warnings中和language_in记录在JavaScript中. 最佳答案 https://github.com/google/closure-compiler/wiki/Additional-Webservic