<div class="dateAdded">Article submitted #article.DateAdded.ToRelativeDateStringUtc()</div>
Compiler Error Message: CS1061: 'System.DateTime' does not contain a definition for 'ToRelativeDateStringUtc' and no extension method 'ToRelativeDateStringUtc' accepting a first argument of type 'System.DateTime' could be found (are you missing a using directive or an assembly reference?)
Here is where my error is occurring. I have a class that contains ToRelativeDateStringUtc() included in my program. Is this a MS class that I have to import? I do not see it listed anywhere in the .net reference list. I'm sure its something simple, does anyone have any ideas?
I have already added the folder to my webconfig that includes the class, which contains the method the program is "missing". So its not missing it... I just dont know what else to do from here.
There are several things you could try.
Firstly, you can try the using directive inside the view you use this in:
#using Your.Namespace.Where.Extension.Class.Is.Located
Secondly, the web.config you've added the namespace to is probably the global one. If this view is inside an Area.. try putting the namespace into the web.config that is inside that particular area.
The first one will work regardless.
Related
I'm creating an Windows Application for the database backup and I've already added the references in my projects.
But I got the error:
'System.Data.SqlClient.SqlError' does not contain a definition for
'Message' and no extension method 'Message' accepting a first argument
of type 'System.Data.SqlClient.SqlError' could be found (are you
missing a using directive or an assembly reference?)
I've already attached the screen shot of the error. Please help me with this issue. Thanks.
As stated in two of the errors, you are missing an assembly reference to System.Data. Add this at the top of your code file (outside of any class or method) as using System.Data; and that should resolve the problem.
Or, right click on the underlined code and use the context menu to automatically add the missing reference.
This is a follow-up question from "c# Wrapper for CNTK step"
After adding reference EvalWrapper.dll, The type or namespace name 'IEvaluateModelManagedF' could not be found error went away.
The next compile error I encounter is at line
model.CreateNetwork(string.Format("deviceId=-1\nmodelPath=\"{0}\"", modelFilePath));
Error CS1061 'IEvaluateModelManagedF' does not contain a definition for 'CreateNetwork' and no extension method 'CreateNetwork' accepting a first argument of type 'IEvaluateModelManagedF' could be found (are you missing a using directive or an assembly reference?)
I made sure all the DLLs are in the same directory as EvalWrapper.dll.
What am I missing ?
Thanks in advance,
I encountered this error too. To solve the problem you should add the following using clause at the beginning of your code:
using Microsoft.MSR.CNTK.Extensibility.Managed;
I have an application on store with the name of Sher o Shayari. Now I want to update that app with bit structure change. I add category screen and comment out code that is not related to new things.
I have screen MainPage.xaml. I comment out all xaml code and changed functionality of this screen. Changed code is working perfect in debug mode. but when I try to create store build for updating application then store build creation display an error.
Error 1 'sher_o_shayari.MainPage' does not contain a definition for 'Valentine' and no extension method 'Valentine' accepting a first argument of type 'sher_o_shayari.MainPage' could be found (are you missing a using directive or an assembly reference?)
Error 2 'sher_o_shayari.MainPage' does not contain a definition for 'Love_Poetry_Images' and no extension method 'Love_Poetry_Images' accepting a first argument of type 'sher_o_shayari.MainPage' could be found (are you missing a using directive or an assembly reference?)
I have removed methods "Love_Poetry_Images", "Valentine" from both mainpage.xaml and mainpage.xaml.cs.
so why I'm getting this error.
This error display for those event which are now comment out. I don't need those so I removed / Comment out from mainpage.xaml and mainpage.xaml.cs.
What would be the problem? is this due to my bit structure change or not.? How to resolve this.? Your assistance will be higly appreciated.
I got solution of this error.
I renamed MainPage.xaml to category.xaml.
Correctly added Namespace for category.xaml.cs.
Then again tried to create store build. this time no error display and I have submitted app successfully.
Note: Please keep your backup before doing this thing or deleting MainPage.xaml
I download FusionChart and try to use in my MVC4 application. When i tried the same in my application i met an error like this. How to solve this. Any one kindly help me. Thanks for advance.
Error is
System.Web.Mvc.HtmlHelper<dynamic>' does not contain a definition for 'FChart' and no extension method 'FChart' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<dynamic>' could be found (are you missing a using directive or an assembly reference?)
You should add HtmlHelper.cs and change namespace as your project name. I am successfully add fusion charts in mvc4.
Please tell me if it is work or not
I am currently working on a project with SignalR. On my production server, it is missing an automatically generated js-file in ~/signalr/hubs.
I wanted to try this solution:
SignalR not working on production server
But when I try to add this line to my application_start method in global.asax, my project will not build anymore. Although intellisense knows and suggests the extension method!
I referenced the namespace with using SignalR;. I tried calling it as an extension method and calling it as a static method with the object instance as the first parameter.
The exact error messages:
When calling as extension method:
Error 1 'System.Web.Routing.RouteCollection' does not contain a definition for 'MapHubs' and no extension method 'MapHubs' accepting a first argument of type 'System.Web.Routing.RouteCollection' could be found (are you missing a using directive or an assembly reference?)
When calling as static method:
Error 1 The type or namespace name 'RouteExtensions' does not exist in the namespace 'SignalR' (are you missing an assembly reference?)
Anybody knows why this happens and how to solve the problem? Many thanks in advance!
I'm pretty sure that it could be one of these reasons:
Your project requires a reference to an assembly that's not added to the project.
Is your project using the .NET Framework version that's compatible with the referenced assembly?
With your given info, it would be hard to determine the exact reason, but I believe that I provided you some helpful hints.
The fact that intellisense suggests you anything like an extension method won't mean that the project has the required references to work properly.