Riz Please ensure that your project has a reference to System. Windows as it appears that ObservableColletion is contained in System.Collections. ObjectModel namespace which is in System.
Windows in . Net 4.0 and System.Collection. ObjectModel in .
Net 3.0 & 3.5. It wasn't available before that. In silverlight it can be found in System.Collections.ObjectModel.
Up vote 2 down vote favorite share g+ share fb share tw.
I am working with Entity Framework in asp.net" rel="nofollow">asp.net c# framework 3.5 I have generated entity classes using poco generator template. But I am getting following error: The type or namespace name ObservableCollection could not be found (are you missing a using directive or an assembly reference? ) FYI System.Collections.
ObjectModel is also added in class. What could be wrong? How to resolve it?
C# asp.net" rel="nofollow">asp.net entity-framework link|improve this question edited Jul 13 '11 at 20:49Mrchief15.1k2735 asked Jul 13 '11 at 20:48eFriend304111 68% accept rate.
The ObservableCollection class is in the WindowsBase assembly in . NET Framework version 3.5, and in the System assembly in version 4.0 – dtb Jul 13 '11 at 20:49 I think in 3.5, the assembly is different – Charlie Brown Jul 13 '11 at 20:49 addind windowsbase reference solved the issue. Thanks dtb.
But now next errors ... :( Error 4 The type or namespace name 'ObjectSet' could not be found (are you missing a using directive or an assembly reference? ) – eFriend Jul 13 '11 at 20:59 1 The ObjectSet class is in the System.Data. Entity assembly in .
NET Framework version 4.0. It does not exist in version 3.5. See: Working with ObjectSet – dtb Jul 13 '11 at 21:06 My Bad :( So .. I can't use these entity classes in framework 3.5 - right? Since I need to build application in Framework 3.5, Is there any alternate to generate classes that support framework 3.5, other than POCO entity generator?
– eFriend Jul 13 '11 at 21:09.
Not exactly. The ObserableCollection class is invariably in the System.Collections. ObjectModel namespace.
However, it is in different assemblies in different versions of . NET: in the WindowsBase assembly in 3.5 and in the System assembly in 4.0. In Silverlight, it's in the System.
Windows assembly. – dtb Jul 13 '11 at 21:20 Yeah, that problem was solved after @dtb comment. Now problem is ObjectSet .. see comments above – eFriend Jul 13 '11 at 21:22.
I think ObservableCollection only exists in . NET 4.0.
That's not correct. The class was introduced in . NET 3.0.
– dtb Jul 13 '11 at 20:55.
Up vote 36 down vote favorite 6 share g+ share fb share tw.
I have a C# solution composed of several projects in Visual Studio 2010. One is a "Test" project (I'll call it "PrjTest"), the other is a Windows Forms Application project (I'll call it "PrjForm"). There is also a third project referenced by PrjForm, which it is able to reference and use successfully.
PrjForm references PrjTest, and PrjForm has a class with a using statement: using PrjTest; Reference has been correctly added using statement is correctly in place Spelling is correct PrjTest builds successfully PrjForm almost builds, but breaks on the using PrjTest; line with the error: The type or namespace name 'PrjTest' could not be found (are you missing a using directive or an assembly reference? ) I've tried the following to resolve this: Removed Resharper (since Resharper had no trouble recognizing the referenced project, I thought it might be worth a shot) Removed and re-added the reference and using statement Recreated PrjForm from scratch PrjForm currently resides inside the PrjTest folder, I tried moving it to an outside folder Loaded the solution on a different computer with a fresh copy of VS 2010 I have done my homework and spent far too long looking for an answer online, no solution has helped yet. What else could I try?
C# visual-studio-2010 reference using-statement using-directives link|improve this question edited Jul 11 '11 at 10:31Amir Ismail2,4991214 asked Jan 21 '11 at 23:36Anders1,5381516 100% accept rate.
1 are you sure the PrjTest has a Namespace named PrjTest – Shekhar_Pro Jan 21 '11 at 23:41 3 Wouldn't you know it: stackoverflow.com/questions/4286599/… Turns out this was a client profiling issue, I didn't even think to check for that.. – Anders Jan 21 '11 at 23:45 @Shekhar_Pro: I'm sure, it was one of the first things I checked.. – Anders Jan 21 '11 at 23:46.
See this question. Turns out this was a client profiling issue. PrjForm was set to ".
Net Framework 4 Client Profile" I changed it to ". Net Framework 4", and now I have a successful build. Thanks everyone!
I guess it figures that after all that time spent searching online, I find the solution minutes after posting, I guess the trick is knowing the right question to ask..
Cheers, solved my issue. Damn client profile caused more than one bug. – Carra Mar 10 '11 at 16:41 Cheers, solved my issue too.
– eka808 Sep 6 '11 at 11:45 Had same issue - thanks. – itsmatt Nov 7 '11 at 13:04 Same issue here. Saved me a ton of time.
Thanks. – Øyvind Knobloch-Bråthen Mar 7 at 9:52.
PrjForm was set to ". Net Framework 4 Client Profile" I changed it to ". Net Framework 4", and now I have a successful build.
This worked for me too. Thanks a lot. I was trying an RDF example for dotNet where in I downloaded kit from dotnetrdf.
NET4 Client Profile: Always target NET4 Client Profile for all your client desktop applications (including Windows Forms and WPF apps). NET4 Full framework: Target NET4 Full only if the features or assemblies that your app need are not included in the Client Profile. This includes: If you are building Server apps.
Such as: ASP. Net apps Server-side ASMX based web services If you use legacy client scenarios. Such as: o Use System.Data.OracleClient.
Dll which is deprecated in NET4 and not included in the Client Profile. Use legacy Windows Workflow Foundation 3.0 or 3.5 (WF3.0 , WF3.5) If you targeting developer scenarios and need tool such as MSBuild or need access to design assemblies such as System.Design.dll.
Thanks for the insights, that is good information to have! – Anders May 26 '11 at 14:33.
The using statement refers to a namespace, not a project. Make sure that you have the appropriately named namespace in your referenced project: namespace PrjTest { public class Foo { // etc... } } Read more about namespaces on MSDN: Using Namespaces.
Thanks Mark, I do have the namespace appropriately named. – Anders Jan 21 '11 at 23:53.
If your project (PrjTest) does not expose any public types within the PrjTest namespace, it will cause that error. Does the project (PrjTest) include any classes or types in the "PrjTest" namespace which are public?
Thanks for the insight, I'm learning a lot about this. PrjTest includes around 50 public classes; it's a decent-sized project – Anders Jan 23 '11 at 17:40.
It is also possible, that the referenced projects targets . NET 4.0, while the Console App Project targets . NET 4.0 Client Library.
While it might not have been related to this particular case, I think someone else can find this information useful.
See this question Turns out this was a client profiling issue PrjForm was set to ". Net Framework 4 Client Profile" I changed it to ". Net Framework 4", and now I have a successful build Thanks everyone!
I guess it figures that after all that time spent searching online, I find the solution minutes after posting, I guess the trick is knowing the right question to ask.
Cheers, solved my issue. Damn client profile caused more than one bug. – Carra Mar 10 at 16:41 Cheers, solved my issue too.
– eka808 Sep 6 at 11:45 Had same issue - thanks. – itsmatt Nov 7 at 13:04.
Thanks for the insights, that is good information to have! – Anders May 26 at 14:33.
Thanks Mark, I do have the namespace appropriately named. – Anders Jan 21 at 23:53.
Thanks for the insight, I'm learning a lot about this. PrjTest includes around 50 public classes; it's a decent-sized project – Anders Jan 23 at 17:40.
PrjForm was set to ". Net Framework 4 Client Profile" I changed it to ". Net Framework 4", and now I have a successful build.
If I understand you correctly, you have written something like this.
I am writing a function proc in my C# 2008 ASP. Net application and I get the following error: The type or namespace name 'function' could not be found (are you missing a using directive or an assembly reference)? Any idea what this means?
C# asp.net link|improve this question edited Feb 23 '10 at 2:24itowlson30.7k33358 asked Feb 23 '10 at 2:17LearningCSharp312212 90% accept rate.
– Anon. Feb 23 '10 at 2:19 Can you post the code in question? – Nick Craver?
Feb 23 '10 at 2:19 Do you have any code? – Mendy Feb 23 '10 at 2:20 // This is all the code I have private function ValidateData() { } – LearningCSharp Feb 23 '10 at 2:21.
If I understand you correctly, you have written something like this: private function ValidateData() {} If that is correct, then you need to change it to something like this: private bool ValidateData() {} where bool in this example, is your return type (boolean). If you have no return (then it is not a function). Here is what you would do then: private void ValidateData() {}.
– LearningCSharp Feb 23 '10 at 2:23 Its not required. If there is no return, then use void – Gabriel McAdams Feb 23 '10 at 2:23 ok, but something is required (either a return type or a void keyword), correct? – LearningCSharp Feb 23 '10 at 2:25 That is correct.
– Gabriel McAdams Feb 23 '10 at 2:25 Thank you Gabriel. – LearningCSharp Feb 23 '10 at 2:26.
Function" is a JavaScript keyword, not a C# keyword. Maybe the compiler thinks your JavaScript is meant to be C#.
Private function ValidateData() { } you need to replace "function" with the return type of the function. In this case it would be void meaning that there is no return value. Private void ValidateData() { }.
Ensure that the Target Framework is set to ". Net Framework 4" in the property pages.
Up vote 0 down vote favorite share g+ share fb share tw.
I have a weird issue. I have a VS 2010 . Net 4.0 Web Site (not web app) that runs on IIS 7.5. When I build the site, I'm getting errors like the one in the title.
Normally, this would be straightforward to fix - just add a reference. In this case, I already have a reference to System.Core. Dll (4.0).
I have "using System. Linq" declared. If I fully quality my references to IQueryable (e.g. System.Linq.
Iqueryable), autocomplete resolves it perfectly. All my folders are read/write enabled. I'm not sure what else to check.
Maybe one of my fellow Overflowers can help? :-) TIA! Asp.net visual-studio-2010 c#-4.0 build link|improve this question asked Jan 20 at 10:12richb01708 60% accept rate.
Is the namespace included in the web. Config? I recall some option like that for non-web apps.
– leppie Jan 20 at 10:15 is it running on an ASP. NET 4 application pool? – onof Jan 20 at 10:16 @leppie - I am referencing the assembly in the web.
Config: thanks! – richb01 Jan 20 at 10:39 @onof - Yes, the app pool is .net 4. – richb01 Jan 20 at 10:44 Found it!
I found the error...it seems that there was an error in an upstream web. Config that was causing my build to fail. I wish I knew why the symptoms manifested the way they did, but I'm building now.
:-) Thanks to all who answered and tried to help. – richb01 Jan 20 at 11:22.
Yes, I am targeting . Net Framework 4" – richb01 Jan 20 at 10:41.
I found the error...it seems that there was an error in an upstream web. Config that was causing my build to fail. I wish I knew why the symptoms manifested the way they did, but I'm building now.
:-) Thanks to all who answered and tried to help.
You should accept this answer – onof Jan 22 at 19:26.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.