I'n using EWS ExchangeService to read emails from outlook... I've coded the in Console project and in VS2008... Everything works fine as it is.. I can read the emails.
To become more familair with VS2010 I created a console project and copied the copied to VS2010 project.
so I added the referene "Microsoft.Exchange.WebServices" (Version 14.2.51.0) in Microsoft\Exchange\Web Services\1.1\Microsoft.Exchange.WebServices.dll folder.
Everything works as it is, so I see the intellisence, I see the methods properties of Exhange assembly etc...
using Microsoft.Exchange.WebServices.Data;
1st Question:
The issue:
- As soon as I click on the build button in VS2010... I get this error:
The type or namespace name 'Exchange' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) Form here all the methods/properties of Exchange assembly get squeezed underline... Intellisence is not working for Exchange assembly anymore. When I remove the assembly from reference and re-added I get the intellesence back again for Exchange assembly... but it happens again when I click on build :(
so I goto my code and type "Microsoft." I don't see the Exchange word anymore....
So I don't understand why this occurs, it works on VS2008 and in VS2010 it's not working? The only way I think is VS was Framework 3.5 and VS2010 is V4.0
any idea where to look? and how to solve this problem?
2nd question:
I need to get attachments of the email.. so when email arrives on special email account, I need to get the attachment and save the attachment-file to a specific folder. What's the best approach here? Create the code in Console project and create Windows service project? or just Console project or just Classlibrry project and add to Task Scheduler? So I need some advice on this how to approach at project level... The programming logic is already there working.
But as I said in my first question I got it working in VS2008 but VS2010 doesn't know th Exchange assembly after I press the Build button.
Answer to Question 1: You need to switch the target framework in your project from ".NET Framework 4 Client Profile" to just:".NET Framework 4".
Related
I am having a problem with an old library I am trying to re-activate (use again). I have a library called "PLToolbox" in which I have multiple namespaces (e.g. "PLToolbox.FileIO", "PLToolbox.Graphics", "PLToolbox.MathNumeric"). As said all these namespaces live in my PLToolbox library (one file, many namespaces).
I now tied to add an old library (one library containing one namespace). This library/namespace is called "PLToolbox.SQLite", and I have added a new "PLToolbox.SQLite" project to my "PLToolbox" solution, and it compiles just fine and everything is working as expected (building my solution it both generates a "PLToolbox.dll" and a "PLToolbox.SQLite.dll").
My problem is the application using these namespaces (both referencing "PLToolbox" and "PLToolbox.SQLite"). When ever I build this project (a Winform application), where I use classes from the "PLToolbox.SQLite" library, it generates an error message saying: Severity Code Description Project File Line
Error CS0234 The type or namespace name 'SQLite' does not exist in the namespace 'PLToolbox' (are you missing an assembly reference?)
The actual line giving this error message is "using PLToolbox.SQLite;", and as the error states, it tries to look for the "PLToolbox.SQLite" namespace within the "PLToolbox" library, even though this namespace is only defined within the "PLToolbox.SQLite" library. If if remove the "using PLToolbox.SQLite;" from my project and in stead prefix all lines (accessing this library) with "PLToolbox.SQLite." it compiles fine, but this is a drag. Likewise I am sure renaming my "PLToolbox.SQLite" into "PLToolboxSQLite" (or something else) would "fix the problem", but this should work some how with the name is has now?
I am sure this is how I used these two libraries together, back in a previous version of Visual Studio (using version 2.0 of the .Net Framework with Visual Studio 2003/2005). Now I am running with Visual Studio 2015 and .Net Framework 4.0, so perhaps this is the cause? or simply I forgot to do something I did back then?
My bad :-( It turned out that my "PLToolbox.SQLite" was targeting .Net framevork "V4.52.0" (whereas my "PLToolbox" and my Winforms application using both libraries were targeting "V4). As soon as I changed "PLToolbox.SQLite" into "V4" and re-build everything was fine.
I've created a class library in C# Visual Express 2010. I built the solution making sure that the target framework was the .NET Framework 4 and not .NET Framework 4 Client Profile.
When I try to create a Console Application and reference the library, none of my classes are recognized.
I have made sure the Console Application is also using the .NET Framework 4 and not .NET Framework 4 Client Profile
I have made sure that I am actually using the namespace of my library.
All the classes I want to access are public.
If I change my Class Library project to a Console Application project, everything works.
Restarting and/or reloading the library does not work.
After I reference my library, it appears under References, but I cannot view it in the object viewer. I'm not sure what this means
The only error messages I receive are:
Error 2 The type or namespace name could not be found (are you missing a using directive or an assembly reference?)
I'm not sure why nothing is recognized, or why I cannot use my library. Does anyone have any ideas of where I can go to look for the solution, or has anyone run into this problem themselves?
I know you have tried a lot of things here, but ultimately the following should work
In your solution make sure you have your class library and your console app (Although you don't need to have the class library in the solution, this is just for sanity sake)
Make sure they are the same framework
Make sure they both compile, take note of any errors or warnings
Add a reference to your library (remove any previous references),i.e click your console app, click Add\Reference, click solution, then check your library, click add
Add the using statement to your console app
Just to make sure everything is good , do a Clean, and rebuild
if you have done all the above and its still not working, then this seems like a benign error
I.e if everything compiles, and there are no warnings, there is really no normal reason why this shouldn't just work
All of classes that defines in class library must have -public- access modifier, unless these assemblies don't work!
I am using the MagicLibrary for a few components. I knew it was written in Visual Studio 2003 and recompiled it in Visual C# Express 2010. It compiled just fine and I could see the library in the folder.
I then created a new project in Visual C# Express 2010 and added the components MagicalLocalLibrary.dll to the Toolbox. They appeared fine with no errors. I put in a control from the Toolbox to my form, and it seemed fine. I then debugged (to see if any errors would occur) and I saw that the reference MagicalLibrary disappeared and I got the error:
The type or namespace name 'Crownwood' could not be found (are you missing a using directive or an assembly reference?)
The thing is that, the reference shows fine under References in Solution Explorer but I can't import it with using or use it in the code (simply is not listed in InstelliSense either) but if i go into the Object Browser and choose "My Solution" it is not listed. I can click on the Reference in Solution Explorer and just change the Copy Local property to True or False, then it will appear in the Object Browser but whenever I debug my project again it disappear.
Any idea why it does this? Thanks in advance.
Check that you are using the .Net 4 framework and not the client profile version
You find that setting when you right-click on your project, choose properties. And under application there is a setting for target framework. If you have chosen the .Net 4 framework Client Profile, then this behavior that you described can happen
I ran into a very similar issue once. In my case the problem turned out to be a missing dependency for the "vanishing" namespace's assembly. What finally gave me the information I needed was the suggestion in this StackOverflow answer to raise the MSBuild output verbosity level. After raising the verbosity setting the IDE should give you a more specific reason why the compilation fails.
I recently migrated a solution from VS2005 to VS2010.
The solution is composed by about 20 project. One of them is in VB.net, the others are C#.
In VS2005 everything was fine, that is I was able to reference the VB.net project into the C Sharp projects. Now I cannot anymore.
The strange thing is that when I open in the editor a C# class referencing the VB.net dll, I get a compile error that sounds more or less like this:
"he type or namespace name 'VB.netProject' does not exist in the namespace 'Solution Namespace' (are you missing an assembly reference?)"
... and no, the assembly reference is there indeed!
However, when I close the files in the editor and try to compile again, the operation succeeds and the executable that I get works perfectly like it did in VS2005.
Is there a way I can manage to see the VB.net component in the editor? I am sure I am missing something, but I don't know what! :-)
Many thanks in advance for your help,
John
Unfortunately the visual studio sets (after the migration) the target framework to .NET Framework 4 Client Profile. If this target framework is set, some namespace could not be found (=> because the client profile doesn't contain this classes). Please verify, if your project has set this target framework. You will find this setting under the project properties.
Kind regards, patrick
this is a very newbie question, sorry!
I need to create an aspx website based con C# and am calling some webservices based on some DLL's I already have. Beforem purchasing Visual Studio, I decided to try Microsoft Visual Web Developer Express (is this ok?) creating a Web Application ASP.NET based on Visual C#.
I created the form to enter the data which is submitted when clicking the process button. At this point I need to call stuff from the DLL, which I have added in the Solution Explorer via Add Reference, selecting the DLL from the COM list. But whenever I run the project, I always get the error "the type or namespace xxx cannot be found - maybe a using directive or assembler directive is missing" when trying to create the object.
What is my stupid mistake?
Thanks!
If you look at the error message, there is another half that you havent covered. At the top of each code file that you want to use the namespace from your DLL, you need to include a "using directive" to let the compiler know that it may be linking to that DLL during compilation. Basically the compiler is wondering where something is, and even thoguh you included it in the function, you didnt take the final step of adding in the using statement at the top of the file.