I have Visual Studio 2015, but can't get the new VB language features to work. Or to show up. It's like the product came without it. The null-coalescing operator doesn't work, read-only auto-properties aren't allowed, etc. This is true even when I set up a brand new project, targeting any version of the framework (which shouldn't matter, but I'm trying everything I can think of).
I've got Resharper 9 installed. Following a suggestion in this question, if I select the project, the VB Language Level dropdown list doesn't show anything more recent than "Visual Basic .NET 12".
There are no LangVersion tags anywhere in the .vbproj files. If I add them it seems to make no difference.
I was under the impression that you didn't have to install anything separately for VB 14, just use VS 2015 and you'll have it (C# 6 actually is available and working in C# projects) but it's not there.
Anybody have any ideas what else I can look for?
It's Resharper.
I'm using Resharper 9.2 Ultimate. Resharper is what's putting all the error messages into the code editor. If I suspend it, all the problems go away, and the code compiles and runs exactly as it should.
I should have taken a cue from the fact that the VB Language Level isn't showing the latest version of VB.
Off to contact technical support.
Related
I'm currently following some tutorials on the EPPLUS NuGet package for reading and writing to excel files.
The tutorials are using new features such as "Target-Typed Object Creation" unique to the C# language versions 9.0 +.
I only just created by project a couple days ago, so it's using the most up-to-date versioning. However for some reason the project uses C#7.3 and therefore I cannot use some of the new features of 9.0 (obviously).
Some examples of the help I need regarding syntax...
All images below are shown for the C#7.3 project
Context
How can I fix the syntax for the red underlined text?
How can I fix the syntax for the red underlined text?
Attempted Fix (not sure if it works since other stuff is still broken
My question is similar to others, but my particular nuance of this problem doesn't appear to have an answer I can find on here so far, so here goes. (edits in italics)
Our company has a deployed application written in VB6. Since VB6 development is no longer officially supported in Windows, our company made the decision to port our VB6 application to VB.NET.
(Prior to this edit, I had mentioned that the project was converted to VB.NET using VS 2015. This was incorrect, I discovered that my coworker had actually performed the conversion using VS 2008, and I was working on the 2008 project in 2015.)
So we are now working with the VB.NET conversion in VS2015. As many of us know, the VS 2008 converter does an incomplete job porting VB6 code to VB.NET code so there are many, many errors to sort through (as of this writing, all compile errors are fixed). In particular, though, I'm trying to open the various forms for the project in the Designer so I can see and work with them. The designer specifically is reporting the error:
Could not resolve mscorlib for target framework '.NETFramework,Version=v2.0'. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted.
I saw some mention of a 256 character limit on dependency paths. This dependency is met in my case. I have also confirmed that .NET Framework 2.0 is installed and active in my instance of Windows. I have seen the recommendation to upgrade the .NET Framework version as well, which was successful in itself but did not resolve this mscorlib issue.
Full call stack for this error follows:
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse..ctor(IDesignTimeAssemblyLoader assemblyLoader, IVsDesignTimeAssemblyResolution projectAssemblyResolution, IVsSmartOpenScope dispenser)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse.GetUniverse(IDesignTimeAssemblyLoader assemblyLoader, IVsDesignTimeAssemblyResolution projectAssemblyResolution, IVsSmartOpenScope dispenser)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkProvider..ctor(IVsDesignTimeAssemblyResolution assemblyResolution, IDesignTimeAssemblyLoader assemblyLoader, TypeDescriptionProvider parentProvider, IVsSmartOpenScope openScope)
at Microsoft.VisualStudio.Design.VsTargetFrameworkProviderService.get_TargetFrameworkProvider()
at Microsoft.VisualStudio.Design.VsTargetFrameworkProviderService.GetProvider(Type type)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.GetType(String typeName)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.GetType(String typeName)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)
How can I gain the ability to view my project in the Designer?
As far as I know, opening VB6 files in VB.NET will not work. You will have to make modifications in Visual Studio 6.0 or re-write the application in VB.NET/C#.
Older versions of Visual Studio (until 2008) had some converters but they never really worked as expected.
You can take a look at Visual Basic Tools for Visual Studio, it "allows to work with classic VB workspaces and projects within Visual Studio.", this will allow you to modify the VB6 project in a newer version of Visual Studio but the code will remain VB6.
Regarding your exact issue, others have reported that the following worked for them:
Remove and add back project references that have warnings.
Rebuild the project
Remove and add back Microsoft.Office.Core
Good luck!
As someone who has converted a number of VB6 applications to VB.Net, I always advise a full rewrite. The languages are just too different. You waste far too much time trying to resolve issues of this type.
Better still, just leave the VB6 application running as is.
Microsoft's VB6 support statement
Is this possible to have a Visual Basic Interactive window in Visual Studio 2015 like we have for C#?
At the time of writing the original answer to this, VB.net interactive was in the pipeline, but no longer. As this answer had been accepted, I can't delete it, so here it stays :-/
For those who came here from Google, no, there isn't a VB Interactive window in VS 2019 at the time I'm writing this, nor do they plan to implement it.
If you clone the Roslyn repository from GitHub (https://github.com/dotnet/roslyn) one of the projects is called vbi, and you can produce a non-GUI version of C# Interactive (no Intellisense obviously) that does a lot of what C# Interactive does.
From a brief investigation it seems to need each line expressed as a function/method call, e.g., evaluating 3 + 4 gives you an error, but System.Console.WriteLine(3 + 4) displays 7 (you also seem to have to full qualify methods). However you can evaluation System.Math.Pow(2, 7) and get 128 as the answer.
Since it's VB input is case insensitive so system.console.writeline(3 + 4) works.
I have projects I have to do in Classic ASP. It would almost be enjoyable if I could get some of the same features that visual studio has, such as intellisense for objects (I know you get some from Visual Studio if you have everything in the same file, but there are quirks with that, as well), or the dropdowns showing functions like Visual Studio. It would be especially nice if it would recognize include files and use those as well. It seems to me that enough people are still using it that someone must have written something...
It seems to me that enough people are still using it that someone must
have written something
You'd think that, but I've been looking for the same thing for a number of years, and even started trying to add the language to Netbeans, but nothing I have found yet matches what you can do in DreamWeaver.
It's a rubbish program that crashes a lot and is far too expensive, but it's about the only option I have found that is any good beyond Visual Studio (2008 or less).
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.