草庐IT

the_date

全部标签

c# - ASP.NET Core RC2 项目引用 "The Dependency X could not be resolved"

概览我有一个ASP.NETCoreRC2.NET框架Web项目,我想添加对同一解决方案中包含的常规C#类库的项目引用。重现步骤:使用VisualStudio2015更新2文件->新建项目->ASP.NETCoreWeb应用程序(.NETFramework)右键解决方案->新建项目->类库我不会做这些:类库(.NETCore)类库(适用于iOS、Android和Windows)类库(可移植)将以下内容添加到project.json中的dependencies中:"ClassLibrary1":{"version":"*","target":"project"}问题为什么在指定项目依赖项时

c# - 等价于 C# 中的 __DATE__、__TIME__ 宏

在C#中是否有等同于__DATE__和__TIME__的东西?基本上我想做的是在C#应用程序中放置一些构建时间戳。Onepossibility我在微软的网站上看到是这样做的:Assemblyassem=Assembly.GetExecutingAssembly();Versionvers=assem.GetName().Version;DateTimebuildDate=newDateTime(2000,1,1).AddDays(vers.Build).AddSeconds(vers.Revision*2);Console.WriteLine(vers.ToString());Cons

c# - 有人知道输出 "Module is optimized and the debugger option ' Just My Code' is Enabled”吗?

正如我在previous问题中所说,我正在将我的应用程序迁移到WindowsMetro应用程序。我得到这样的输出我不明白这个输出,如果有人知道请告诉我! 最佳答案 通常,您不需要模块加载消息,但默认情况下它们是打开的。工具->选项->调试->输出窗口->模块加载消息->关闭 关于c#-有人知道输出"Moduleisoptimizedandthedebuggeroption'JustMyCode'isEnabled”吗?,我们在StackOverflow上找到一个类似的问题:

c# - T4 模板错误 : loading the include file ef. utility.cs.ttinclude 返回了 null 或空字符串

我已经覆盖了Controller生成T4模板(ControllerWithContext.tt),如here所述.我想利用在POCO模型生成器T4模板中使用的EF.utility.CS.ttinclude中的代码帮助实用程序。因此,我将以下行从我的Model.tt复制到我的ControllerWithContext.tt。但是,当我尝试添加Controller时,我收到了错误消息Loadingtheincludefile'EF.utility.CS.ttinclude'returnedanulloremptystring根据MSDNdocumentation,这个错误是因为包含的文件是

c# - 通过自定义结构类型验证原始 .NET 值类型 : Is it worth the effort?

我正在尝试通过将原始.NET值类型包装在自定义struct中来使原始.NET值类型更加类型安全和更加“self记录”。但是,我想知道在现实世界的软件中是否真的值得付出努力。(That"effort"canbeseenbelow:Havingtoapplythesamecodepatternagainandagain.We'redeclaringstructsandsocannotuseinheritancetoremovecoderepetition;andsincetheoverloadedoperatorsmustbedeclaredstatic,theyhavetobedefin

c# - System.Net.ProtocolViolationException : You must write ContentLength bytes to the request stream before calling [Begin]GetResponse

我得到了"System.Net.ProtocolViolationException:YoumustwriteContentLengthbytestotherequeststreambeforecalling[Begin]GetResponse"errorwhencallingtothe"BeginGetResponse"methodofthewebrequest.这是我的代码:try{StreamdataStream=null;WebRequestWebrequest;Webrequest=WebRequest.Create(this.EndPointAddress);Webrequ

c# - XML 序列化错误 : 2 types both use the XML type name, 'Relationship',来自命名空间 ''

我在通过XML进行序列化时遇到问题,因为2个类使用一个类(尽管类不同!)称为关系。我尝试使用XML属性用另一个名称装饰其中的一个类,但它仍然给我以下错误:{"Types'SiteServer.Relationship'and'LocalServer.Relationship'bothusetheXMLtypename,'Relationship',fromnamespace''.UseXMLattributestospecifyauniqueXMLnameand/ornamespaceforthetype."}这是我的2个类(class),有人知道为什么吗??我使用了错误的属性吗?它似

c# - 使用 Json.Net 反序列化时出现错误 "Cannot deserialize the current JSON array"

我有一个字符串:[{"key":"key1","value":"{'Time':'15:18:42','Data':'15:18:42'}","duration":5},{"key":"key1","value":"{'Time':'15:18:42','Data':'15:18:42'}","duration":5}]我的模型类:publicclassCPacket{publicstringkey{get;set;}publicstringvalue{get;set;}publicintduration{get;set;}}我使用Json.Net,我想将下面的字符串转换为Json对象

c# - 编译转换 : The type 'Object' is defined in an assembly that is not referenced

我正在对一个asp.NetMVC5网络应用程序进行一些更改,我在其中使用了typelite从C#类创建.ts定义(非常方便)。出于某种原因,现在我在执行T4时遇到了这个错误:Compilingtransformation:Thetype'Object'isdefinedinanassemblythatisnotreferenced.Youmustaddareferencetoassembly'mscorlib,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e,Retargetable=Yes'.和这个警告:C

c# - Hangfire 禁用并发执行 : What happens when the timeout expires?

根据Hangfire0.8.2announcementpost,Hangfire有一个DisableConcurrentExecution过滤器,当应用于一个方法时,它会阻止该方法的多个实例同时执行。DisableConcurrentExecution过滤器采用timeoutInSecondsint参数。来自链接文章中的示例:[DisableConcurrentExecution(timeoutInSeconds:10*60)]publicvoidSomeMethod(){//Operationsperformedinsideadistributedlock}我的问题是:给定一个正在等