Migrating project from .NET 2.0 to .NET 4.0 - .net-4.0

I'm migrating my solutions from .NET 2.0 to .NET 4.0. I open the solution file in VS 2010 and follow migration wizard.
While building the solution and comparing the changes with the server copy (since solution is under source control VSTS), I surprisingly found that
1) the public classes were changed to 'internal' and
2) the 'public static' properties were changed to 'internal static'
It gave me problem because the output assembly is referred in other projects.
Can someone explain why does it happen? Also, are there any other such changes taking place behind the scene? Or Am I doing something wrong ?
(Note: I have ReSharper 5.1 installed but I think it has no place in this case.)

ReSharper may have given the suggestion to make methods static for those methods which are not using any instance variable or method within it. This is what I have observed.
Similarly, if the methods are not accessed from any other project/assembly, it may give you suggestion to make them internal.

Related

Why I can't use Shell method in VB.NET?

I see everyone is using the Shell command without any problem, but it doesn't work for me, it says it's not declared like it doesn't exist. I'm working in Visual Studio using VB.NET.
Interaction.Shell is in the Microsoft.VisualBasic namespace, which should automatically be imported for Visual Basic projects.
If it isn't in yours, you can fix that in the project properties (Tab "References") or manually add Imports Microsoft.VisualBasic at the top of the code file.
Another possible reason is that Interaction.Shell is not included in .NET Core versions prior to 5. In that case, use a "classic" .NET Framework project or .NET 5 or higher instead. (Credit to Hans Passant in the comments.)
I have recreated the app, without change anything and now it works... In any case, thank you to everybody for the support.

VSTO2010: Reference to class 'RibbonBase' is not allowed when its assembly is linked using No-PIA mode

When I try to compile my VSTO Outlook addin, I get this error:
Reference to class 'RibbonBase' is not
allowed when its assembly is linked
using No-PIA mode
Can't seam to find a solution to it online.
Any idea?
Thanks!
Mojo
Certain COM libraries, including this one, do not support No-PIA mode.
Change Embed Interop Type to false in the properties of the reference.
I can't swear that what I'm about to offer would fix the RibbonBase issue, but I received exactly the same error message with respect to a class I was trying to use in Access, and found myself reading this question & answer, so I'd like to offer my solution as I suspect strongly that it might also fix the RibbonBase problem.
The issue is one of referencing a CLASS rather than an Interface. If you search for "is not allowed when its assembly is linked using No-PIA mode" in http://msdn.microsoft.com/en-us/library/h8c469ey.aspx, you can see where I get this from.
It kind-of makes sense - I can see that making the interfaces available gives a better object design (by separating interface from implementation) and would also reduce the meta-data required.
In Access, I was trying to reference ControlClass, and when I switched to using just "Control" (it's interface) then all worked fine for me.
From what I've read, I believe that SLaks solution, while it will undoubtedly work, it will require the Interop assemblies to be instelled on the machine that the solution is deployed on, where as switching to an interface (if possible) then allows you to deploy without the Interop assemblies. For me, that makes my suggestion more attractive, if it could be applied in the case of "RibbonBase".

Location of VB.NET "source" code, similar to Java's JDK src.zip

Does VB.NET have anything similar to Java's JDK source code? When I used to work in Eclipse, I could right click and view the generated code, or "look under-the-hood" so to speak. I found this feature very helpful in understanding what was happening behind the scenes, and it helped me to write better, more simplified code.
I have so far been working with Visual Studio 2010's Object Browser, and I have also been looking at the generated designer files, but these often do not drill down far enough.
The best program to do this is called .NET Reflector and you can download it from here: http://www.red-gate.com/products/reflector/
It lets you see executables and DLL's under the hood
ScottGu has an old blog post about this:
http://weblogs.asp.net/scottgu/archive/2008/01/16/net-framework-library-source-code-now-available.aspx
You can also use the .NET Reflector to peek into the code for any .NET dll, but keep in mind it won't look like the code in Visual Studio :)
http://www.red-gate.com/products/reflector/

Visual Studio 2010, using VB.NET. Intellisense does not recognize new property until I recompile

I have an ASP.NET VB.NET web project that references a VB.NET class library.
I add a new property to a class in the class library, then, from the web app, I expect to be able to use it immediately w/o errors and with full intellisense.
It used to work in 2008.
When I compile the class library, it becomes available but not until.
Was this nice feature taken away, perhaps in the interest of speed?
What's likely happening here is that the Class Library and ASP.Net applications are targeting different versions of the framework. If they are using incompatible versions of the framework then VB.Net will treat it as a file reference instead of a project reference and would give you the behavior you're seeing.
Right click on the project, select the Appilication Tab and make sure that both have the same value selected for Target Framework. That should fix the problem.
Visual Studio 2010 will officially launch on April 12, 2010. I'd say there's a good chance that problem will be fixed in it. Go see.
EDIT: corrected the date.

Zune API ZuneCore.dll

I noticed the other day that the Zune PC Software exposes a type library (ZuneCore.dll). It seems to be related to the WMPLib API in some way but I can't figure out how to use it either from VB6 or C#.
Has anybody tried this and had any luck?
Dave
May be an old question, but this link might help: http://zunelcd.codeplex.com/ If you download the source for this project one of the class libraries is a decent API for communicating with the Zune Software.
i just found out about this -> http://soapitstop.com/blogs/fleamarket/archive/2008/03/03/read-the-zune-collection-in-net-from-zune-s-own-api.aspx but it seems a bit outdated Initialize method now takes some parameters and i dont know what to put there!
Try adding a reference to it from a .NET project in Visual Studio. Perhaps this namespace will appear magically: MicrosoftZuneLibrary