migration problem VS2005 -> VS2010 - missing assembly reference error - c#

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

Related

The type or namespace name does not exist in the namespace ''are you missing an assembly reference ?"

I have a solution that worked fine until the last couple of days which contains around 15 projects that are DLLs or Webforms applications. I also use ReSharper which is another peculiarity related to this solution.
There are naturally projects referencing other ones within the solution and all but one compile independently and run OK except one Webforms app (A) that refers to namespaces within another Webforms app(B) DLL.
(A) has 7 exceptions when I try to debug this all along the lines of "the type or namespace name [MyClass] does not exist in the namespace '[(B) namespace]' (are you missing an assembly reference?)"
All the projects target the same .net version 3.5 all target the same processor CPU architecture, I have cleaned the solution, recreated the reference to (B) from (A), can see the namespace in the object explorer when looking at it from (A)\bin so it's there... but still (A) at build has these errors above and for over a day now I cannot for the life of me work out why... can anyone help?
If I run the Webform app (B), it builds and runs without a problem...
The mention of ReSharper is due to it also not working with this solution anymore (but does work with others solutions), the behaviour of ReSharper with this solution is that I cannot type characters into VS anymore unless ReSharper is suspended. Also when searching for types the list does not filter down at all - so there is some sort of corruption there although I have cleared caches related to ReSharper.
The problem might be your virtual directory in IIS, it was not pointing to the correct folder, so the page couldn't find the DLLs
Brad McA, have you unblocked that namespace? In REFERENCES folder, right click on the particular reference, and see if there is an option "Unblock", If u can see it, kindly unblock it. Thanx
Seems to be building now, reason for failure was a dependency on Newtonsoft.Json.dll which was built to target .net 4 (strange as this reference in (B) has been there for ages! why it would suddenly cause build issues).
Thanks to those who posted, have a lovely day.
the dll reference were origionally built in framework 4.7.1. when trying to add the reference in lower framework project say 4.5.2. It gives such errors. try to update your project framework from 4.5 (lower version) to the version of your reference.

Namespace errors when converting a project to VS 2010

So I'm a fledgeling programmer that's been assigned to get to know an application that's been in development (in VS2005, then in 2008) for quite some time. Over the life of the project the naming conventions therein have become somewhat convoluted. For the sake of example, here is a piece of the naming structure.
_MegaCorp.sln
Application_Install
Megacorp
DbResources.csproj
Forms
Megacorp.Forms.Concept.csproj
Properties
Resources
Megacorp
Forms
Concept
xyz.cs
It's maybe not the best way to organize information, but it works fine in VS2008. Updating to VS2010 shouldn't necessitate an overhaul of the existing code, right?
What's happening is this: when xyz calls for DbResources, visual studio is looking in Megacorp.Forms.Concept.Megacorp, not in the parent Megacorp folder. All the proper references and using statements are in order: as I said, everything works fine in VS2008. What's happening here?
Error 826 The type or namespace name 'xxx' does not exist in the namespace 'MegaCorp.Forms.Concept.Megacorp.Forms.Concept' (are you missing an assembly reference?) C:\x\y\c-sharp\Megacorp\Forms\Concept\ConstructEditor.Designer.cs 99 63 MegaCorp.Forms.Concept
UPDATE: If I add global:: before each use of a class in xyz.cs, this resolves the problem. However, there are about 1,000,000 lines of code, and over 400 errors reported by the compiler. I'm sure that if I combed through each of the 400 errors, pasting global:: before each one, more errors would arise. There must be another way to do this, because again, the solution comprises a very functional and in-use application compiled in VS2008.
Thanks for your help!
I had similar issue and found out that it is related to Target Framework. Check if all the added references are of solutions for same Target Framework.

Class Library Intellisense not showing up after adding the dll to the references

In C#, I made a ClassLibrary that has one Namespace and one Class.
I saved it and build it.
in other Projects, when i use it, I add it to my references by browsing to the .dll location.
But The Problem is that its name is not showing up in the Intellisense.
i.e when I: using ... my dll doesn't show ..
I'm Importing the library to a ConsoleApp.
both of the App and the library target Framework is .NET Framework 4.0
and I made their Assembly Version 4.0.0.0 so they're the exact same.
is there a setting or something that I'm missing ?
how can i make it pop up ?
I'm using VS2010 Professional
Thank you for your help
Maybe this be usefull, I was having a similar issue, I have a Web project, add the reference to a Class Library by selecting the project, but if I made a change on the class library, I canĀ“t see that change on the intellisense of the Web Project, after try many things, I see that in the recently added reference, the value of the option "Local Copy" was set "True", then I change it to false and everething works!
I had a similar issue but in my case it was a property on the class. If you go to the file properties and look for a Build Action. Somehow mine was set to Content it had to be set to Compile.
I am using Visual Studio 2013. I hope this helps someone else.
Is the namespace for your assembly different than the namespace for your currently open project? I've had times when the current project and an assembly share the same namespace path the intellisense can mess up.
In general, Visual Studio is pretty good about intellisense generation, especially for C#. But sometimes there are some interesting conditions regarding ambiguities, and especially mixing project types where it just doesn't quite work.
Placing your content in the same namespace makes me wonder if you've actually fixed the problem (it may just be autocompleting the namespace in the currently loaded project rather than the assembly), but if it allows you to continue working, then go with it!
Right click on project on which you add reference of your dll/project select menu project dependancies and select/MarkCheckBox for reference project/dll. then it will work fine.
If the class library project had its name changed after creation, then intellisense may fail finding it due to directory issues, I believe.
I created my class with the generic "ClassLibrary1" or whatever, and then later changed the default namespace, class name, and project name inside of VS2017. I closed VS2017 and changed the directory name to match my default namespace, and then re-associated the project file in VS2017, and then re-added the reference in my main project file.
All seems to be fixed now.

Reference disappear upon debug/build (C#, VB.NET, VS2010)

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.

Namespace 'SharePoint' does not exist in the namespace 'Microsoft'

So I am starting to learn C#, like literally just started learning, and coming from a Java background, it doesn't look too bad. However, I have a question. I am following THIS tutorial on using the client-object model. And just starting from the top, I added the references, but using Microsoft.SharePoint.Client; keeps giving me the error that "the namespace 'SharePoint' does not exist in the namespace 'Microsoft', but I clearly see it on the right side panel. So looking at the instructions, the only difference I can think of is that fact that I am using Visual Studio Express and thus do not have the option to choose which framework to use when creating a new project. Other than that, I don't know what the problem might be. Does anyone have any ideas on what else I could be missing or how to correct this problem?
Make sure that the target framework is 3.5 and not 4 i.e for SP2010
Did you add the references to the Microsoft.SharePoint.Client assembly and Microsoft.SharePoint.Client.Runtime assembly as noted near the beginning of that tutorial?
Add required references to the solution.
Make sure that the target framework is 4 for SP2013(3.5 for SP2010).
Did you do this part of the tutorial you mentioned above?
To build the application, you must add references to two assemblies,
Microsoft.SharePoint.Client.dll and
Microsoft.SharePoint.Client.Runtime.dll. Installing SharePoint
Foundation installs these assemblies on the server. The two assemblies
are located in the following directory:
%ProgramFiles%\Common Files\Microsoft Shared\web server
extensions\14\ISAPI
Take a look at the references in your project and make sure you have the reference to the assembly. If it is not there try adding it, right click -->add reference and find "Microsoft.SharePoint.Client"
Thanks to those who mentioned the 4.0 framework.
Mine defaulted to .NET Framework 4 Client Profile (and I have no idea what that means), and the Namespaces looked good in Intellisense, but the build would say they weren't found! Crazy.
for anyone developing for SP2019, you need to target .net 4.5

Categories