Visual Studio 2017 not highlighting errors - vb.net

I recently upgraded from Visual Studio 2012 to 2017 (updated to version 15.3.5) and have some issues with the IDE.
In a certain project, I don't get error underlining.
and in the Error List pane, "Build Only" actually shows more information than "Build + IntelliSense"
Also, with "Build + IntelliSense" selected, I can only see the compiler error in the Output window. Here is the error list after a failed build
but the output window has this:
3>------ Build started: Project: ..., Configuration: Debug Any CPU ------
3>C:\Checkout...\MainForm.vb(454,27): error BC30311: Value of type 'Module1.aClass' cannot be converted to 'Module1.bClass'.
This doesn't happen on all projects. I made a new project to see if I could reproduce, and I can't. Here is a new project with the same code, where the error is underlined in code and "Build + IntelliSense" works.
I have even sorted the xml in the vbproj files and "diffed" the offending project vs the new project, and there is no obvious difference which would cause this. Both reference the same compiler. Both projects target .Net 4.6.2 and are set to compile for x86 only. The offending project references a few other projects (C# and VB.Net) plus a third party dll and a nuget package. Aside from these differences there is nothing else.
Other projects (C# and VB.Net) in the offending project's solution work fine.
I have seen similar issues talked about online but no fixes have worked for me. I have tried the "Repair" option in the installer. I then uninstalled Visual Studio and reinstalled.
Update:
Changing the target framework seems to have some effect. A project with this behavior was targeting 4.6.2 and showing no errors, and when it was changed to 4.7, it showed a compile error. Then changing back to 4.5 it showed an error. Then changing back to 4.6.2 it showed no errors. Repeating the process proved to be non repeatable. 4.7, 4.5, 4.6, 4.6.2 - whatever, now all show no errors.
It's also important to link this Microsoft page https://developercommunity.visualstudio.com/content/problem/7759/no-errors-displayed-in-the-error-list.html as many other people seem to have a similar issue.

I have solved the problem, at least in my solution.
I was playing around with project references, and found that when a particular project was not referenced by another project, I got error underlining. I went through a process of changing framework version targets until something worked.
All my projects had previously been targeting .NET 4.6.2. By targeting 4.7 on all the projects, I now get proper error underlining and reporting in the Error window.
I'm not sure if this is a solution for everyone and it will take some additional work on my end to deploy my project to production but I can accept this.
I guess this is related to targeting 4.6.2 using Visual Studio 2012 and upgrading to 2017. Maybe something was not set properly if/when the projects were upgraded.

Related

VS show alot of errors (E1696, E0020) and warnings (C26451, C4754) with a new project

When I starts a new project (Blank App (C++/WinRT)) on Windows10 1909 # VS2019(up to date) its shows up a lot of errors as if the extension wasn't installed. But after trying to compile and run its works - so why do I get the errors and how can I solve this? screenshot
Edit: I have fond a solution for that. its turns out that the project was needed an additional include directory:
under the project properties->C/C++->General->[Additional Include Directory]
I added the winRT folder:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt
screenshot2
and that's it now there's no errors (correction - after creating new project its still have the same errors)
edit2:
Update: I installed the last windows 10 SDK and was still getting the seam errors. Than I installed a package via cmd with the following command:
D:\vcpkg> vcpkg install cppwinrt:x86-windows
after this was done it seem to work now
edit3:
I'm sorry for the annoying newcomer questions...
its looks like I have another problem now with my project
in the packages.config file is says that the package is not declared with the following warning packages.config pic
thanks for any help in advance.
(edit4) I followed this thread:
nuget 'packages' element is not declared warning
and that's it, now all I have to do is to learn how to code :D
The 'standard' include paths for Visual C++ projects are the VC_IncludePath and WindowsSDK_IncludePath. The Windows SDK includes path already has all of the directories:
include\<10.0.build.0>\ucrt
include\<10.0.build.0>\shared
include\<10.0.build.0>\um
include\<10.0.build.0>\winrt
include\<10.0.build.0>\cppwinrt
"Blank App (C++/WinRT)" is not part of the standard VS 2019 template set. The name of the project in the screenshoot is "ConsoleApplication2", which would imply you created a Win32 console C++ project instead of a C++/WinRT project. Even still, you can reach the standard C++/WinRT headers from a Win32 console application since they are part of the standard path.
From the looks of the errors in your first screenshot, it appears you are using a generated C++/WinRT rather than the one in the Windows 10 SDK. With VS 2019, you must add the NuGet package Microsoft.Windows.CppWinRT to your project to get the MSBuild rules needed to build with the C++/WinRT VSIX installed, so that's likely a problem here. See VS Marketplace

Is it possible to execute a vbproj with mono?

I have to continue a program witch have been coded with Visual Studio and the framework .NET framework 4 but the thing is : I have a macbook.
After many researches I have found that by using Mono it was possible to code in vb.net with a mac. However, the project is working on Windows computer but I get this warning:
"warning MSB3256: No assemblies were read in from the redist lists. A TargetFramework profile exclusion list could not be generated."
and this error:
"error MSB6006: "vbnc.exe" exited with code 1"
So I'm guessing that he doesn't recognize that mono should replace .NET framework. I am executing the code with MSbuild, maybe that is the issue?
Unfortunately you are stuck.
Microsoft would like to bring C#/VB and .NET Core to Mac via Visual Studio for Mac, so you should not attempt to bring any .NET Framework projects to Mac via Mono any more.
This warning is more critical to VB developers, as Mono's VB support (vbnc.exe is Mono VB compiler) is experimental and does not support all VB latest features.
However, for .NET Core development, VB is also not yet ready to be used, and should be available in a few months when Microsoft ships .NET Core 2.0.
You can definitely play with VB by using .NET Core 2.0 Preview build,
https://www.infoq.com/news/2017/05/netcore2preview
But then you cannot use VS for Mac, and have to use an editor such as Visual Studio Code.
For some reason, Mono uses vbnc by default although there is a Roslyn-based VB compiler built-in to Mono, vbc. Interestingly, vbnc is even not being installed with mono-devel package and it still being used by default.
If you installed vbnc and started to get this message:
"error MSB6006: "vbnc.exe" exited with code 1"
you need to instruct Mono to use vbc instead and your code will build. The most reliable way to do it is to set it per project, by adding the following XML to your vbproj file:
<PropertyGroup>
<VbcToolExe>vbc</VbcToolExe>
</PropertyGroup>
The code should be placed inside the root <Project> tag.

Global Assembly Cache - Assembly Install required

I am currently updating a VB.NET application with Visual Studio 2013 that possibly was originally created on VS2010 or VS2012.
This application uses a Network SQL Database
Everything goes fine up to the point of installing when just shows an error message. that says the Assembly 'Microsoft.VisualBasic.Shell.9.0' version 2.0.0.0
is required and then will not let me finish the installation.
The project has been exported using the Visual Basic tool [OneClick]
I have already checked the References list on the Project menu, and is not included there. Also not available to be added.
The project requires the Microsoft Framework 4.5, so it seems that the Shell v2.0.0.0 is pretty old...
Do you have any suggestions, this kept me scratching my head already quite a while...
I finally figured it out.
I am not too sure if this is the right solution or not but it worked for me. Hopefully this will help someone else.
It turn out to be a error with the framework I was compiling the project (v4.5),
I was trying to install it on a Windows 7 machine with a framework installed up to v4.0. I cant understand why this error message showed up instead of telling me the framework version required for the software was not installed.
But anyways, I changed the version on the compiler, build and export again. Another error pop up but it was because references to the DLL for the different framework version were not included in the project. After including them and set the value for "Copy to Local" to true, the installation worked like a charm.
So I got my program up and working.

Visual Studio won't find references

I'm working with some application handed over by another person in which I must document the requirements, build and deploy processes.
The problem here is that Visual Studio (2005) is throwing a lot of errors since it can't find the references for the dlls.
This obviously won't let VS build the project.
Everything works fine on the persons computer but not on mine, even though the project references the same folder where the dlls are, the bin folder.
How can I circumvent these problems and get VS to properly reference the dlls?
The following printscreen shows the references screen for the project.
My guess is that your DLL uses a more recent .NET framework than your application does.
Check the properties for your DLL source (right-click on the DLL code in the solution explorer and choose Properties). Go to Application - Target .NET framework and compare the version to the one the application itself uses (right-click on the project code). Note: under your application properties check both the settings under Application - Target .NET framework AND under Publish - Prerequisites.
For what it's worth, even after changing the .vbproj file and removing many lines about hard coded values,
I eventually checked out the project again removed all references to the given DLL and then added it using the GUI.
Lesson learned, don't try to change out one DLL for a newer version without using VB2005 GUI.
The easiest solution will probably be to transfer everything to another project. It will be incredibly time consuming to find where visual studio has left the hard coded path at.
WOOT!!!! Compile the DLL file to a lower version of the .NET framework, and it will fix the problem!!!!
The paths in the project file cannot be the same or the assemblies referenced have a different version.
It might be worth unloading your project and the editing it to inspect where it's looking and for what version.
I had the same problem with an older Visual Studio Project that I opened in Visual Studio 2008. I tried to add new references to the project and got permanent errors that the dll's cannot be found. After the migration of the Project to Visual Studio 2010 I got the following error message when I tried to add a new reference:
'mySample.dll' or one of its dependencies, requires a later version of the .NET Framework than the one specified in the project. You can change ...
After changing the projects .NET Framework to a newer version everything works fine.
Good suggestions in other answers. In my case, it was because the libraries weren't copied (downloaded) successfully: the files existed, but were 0 kB.
Did a clean, which removed all the DLL's and then VS2008 complained it couldn't find the references (Duh!!!) and wouldn't rebuild....luckily I had and old version of the dll's and replaced them in the directory AND THEN did a rebuild to replace them...all references are now OK and we're back to normal....good old VS 2008

What does "Predefined type 'System.TypedReference' is not defined or imported" mean on Metro project?

I am currently converting a library to be a Metro library for Windows 8. I've created a brand new project in Visual Studio 2012 using the "Class Library (Windows Store apps)" C# Template. I've been adding a lot of files and working through the compile errors, but the one that's confusing me is:
Error 2 Predefined type 'System.TypedReference' is not defined or
imported CSC MyNewProject
The "CSC" appears under the "File" column. Double-clicking the error does nothing. Googling only gives me this:
Do not specify the /nostdlib option from the command line compiler.
Make sure that the project refers to the correct mscorlib.dll.
Reinstall the .NET Framework common language runtime (if the previous
solutions do not solve the problem).
(source http://msdn.microsoft.com/en-us/library/f5c3ehka.aspx)
I'm not using a command line compiler, I don't know how to include or exclude mscorlib - because unlike previous .NET apps in Visual Studio, the only thing my project references is ".NET for Windows Store apps" and "Windows" (something I'm still getting used to).
Any thoughts/advise on this?
That Object is not available or has been relocated for the new ARM .NET architecture.
Here is the Full API for you to search, I would of searched for it, but it is missing a search func.
http://msdn.microsoft.com/en-us/library/windows/apps/br211369.aspx
For anyone else who encounters this, I experienced this while I was converting a project to run on metro. I continued to fix other issues (at the time this was one of hundreds of errors) and eventually this just simply disappeared. My plan was to eventually compare this to a new metro project in a text editor once I fixed all the other errors, but it solved itself before that could happen.