Error: System' could not be found (are you missing a using directive or an assembly reference?) in vs 2019 - asp.net-mvc

I tried creating a asp.net core web application with mvc in visual code 2019 and as soon as I open it it showes me a lot of errors like in the picture.
enter image description here
I triend closing and restarting vs, cleaning and rebuilding the solution and restoring nuget packages and it is still not working.

I got similar issue where it was not able to detect the namespaces from .Net library. I uninstalled the SDK and reinstalled it. then it worked !
Check whether .Net SDK is installed properly in your system and do a clean install once again.

Right-click your project name then open the properties windows after that downgrade your Target framework version, build Solution then upgrade your Target framework version which is the latest, and then again Build Solution.
Hope it will resolve your issue.

Related

Package installation error when new blank application in nanoframework is created

When i try create new blank application in nanoframework, i get package installation error.
error message
It seems some problem in nanoframework visual studio extension, my version is NET nanoFramework VS2019 Extension v2019.5.0.8.vsix, but i also tried another versions with same problem.
I have visual studio 2019 community edition and i have installed almost all components.
When i press ok, project is loaded, but is not possible compile it, because there are missing all assemblies. When i try add assembly, theres nothing to add and add nuget packages from nanoframework store leads to error.
when i try this:
pm> Install-Package nanoFramework.CoreLibrary.NoReflection -Version
1.10.1-preview.9
I get this error:
NU1202: Package nanoFramework.CoreLibrary.NoReflection
1.10.1-preview.9 is not compatible with netnanoframework10 (.NETna noFramework,Version=v1.0). Package
nanoFramework.CoreLibrary.NoReflection 1.10.1-preview.9 supports: net
(.NETFramework,Version=v0.0)
similiar when i try another package versions.
So the extensions is installed incorectly, but i cant find why. i tried it more times. uninstall and install again. from extenstion store, and from disc. nothing successfull.
The webserver NuGet released today fixes the issues with the version mismatches.
The issue with VS2019 16.9 remains. Reported to VS Developer Community here. Please up vote to help increase priority.
What is the Community version you're using?
After a little test, there seems to be an issue with the latest release of VS2019. A work around would be to:
Use V16.8.X
or
use an already created solution that you can edit.
or
add the required nuget to the project once it has been loaded (after the error):
Update: now fixed! it was due to a change to fix nuget, but caused an unintended consequence with nanoFramework.

Visual Studio Mac Can't run ASP.NET Core Project

This may be very obvious in hindsight. When installing the new VS Mac, and creating an ASPNET Core project, I can't run it by clicking the run button in the top left.
I can run if I right click on the Web project, click 'Run With' then 'Custom Configuration'. Works great.
However, the run item is disabled and I can't figure any way to enable it: http://prntscr.com/f7rsgh
Try loading the solution using Jetbrains Rider. https://www.jetbrains.com/rider
This sounds like it may be the same issue:
https://developercommunity.visualstudio.com/comments/79790/view.html
If you expand the comments, someone says:
OK installing 2.1.0-preview1-006776 breaks VS Mac 7.0.1. I see the same problem that you are seeing. There is a NuGetFallbackFolder in the sdk folder and VSMac incorrectly uses that as the latest sdk folder. So for now you can fix this by removing the /usr/local/share/dotnet/sdk/NuGetFallbackFolder/ folder. Although that may break the 2.1 preview version of the dotnet cli if you are using it from the command line. VSMac seems to be OK running and debugging ASP.NET Core projects after removing that folder.
It seems to have fixed the OP's question from the forum thread. This is a bug with Visual Studio for Mac that's been fixed in a pending release, but the update doesn't seem to be out just yet. I hope this helps you out in the meantime.
Download and install the latest asp.net core
Download or upgrade to
the latest openSSL
This helped me

Xamarin.Forms with Realm - issue resolving files when bulding iOs

I've created a Xamarin.Forms solution (with PCL) and included realm nuget both on all my pcl's and my platform specific projects. When I compile the iOS project from within Visual Studio 2015 (from a PC connected to my mac)
I get following compile error:
:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(700,3): error :
Failed to resolve assembly: 'Realm.Sync, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null''
But from my mac running in Xamarin Studio, it compiles without any problem.
Does anyone know what the problem could be?
I have created the Realm issue 1264 to track this but will copy solutions here.
The solution suggested by Andy Dent actually solved the problem - we had later crash, which lead me to think it didn't, but that was on our side.
Please try building with the 1.0.4 NuGet - see the breaking change in github.com/realm/realm-dotnet/blob/master/CHANGELOG.md that was added in 1.1.0

DNX design time error - System cannot find file specified

When i try to run the ASP NET 5 solution, i get below error.
Microsoft Visual Studio Error
The following error occurred attempting to run the DNX design time process (dnx-clr-win-x86.1.0.0-beta8).
The system cannot find the file specified.
The DNX design time process provides intellisense, build, and reference information to Visual Studio and without it your experience will be very limited. Please try closing and reopening Visual Studio to see if that corrects the problem. Alternatively, check that the DNX version is properly installed or try changing to a different installed DNX version using the project property pages.
The project is not finding DNX SDK (if you look at the project properties you may see an empty drop-list next to 'Solution DNX SDK version').
If you are on windows 7, I suspect you may have an old version of powershell installed. You need at least version 3.0.
See this answer on a similar issue:
https://stackoverflow.com/a/31549273/299529

assembly uses System.Web.Http 5.1 which has a higher version than referenced assembly System.Web.Http 5.0

I created a new Project in Visual Studio 2013, a WebApi & MVC 5 project and updated all nuget packages. It updated to mvc 5.1. Now I cannot Successfully build the project it says
assembly uses System.Web.Http 5.1.0.0 which has a higher version than referenced assembly System.Web.Http 5.0.0.0
Anyone run into this before? Why these kind of problems do occur so often in Visual Studio? Does anybody know how to solve this because I really am trying hard but no luck so far...
Solved
I opened the Package Manager Console in Visual Studio and run the command
PM> Update-package
It magically resolved everything for me. You can find Package Manager Console under
Tools
Nuget Package Manager
Package Manager Console
This command deletes all the old packages under the package folder and updates everything if necessary, you may also run the command on a specific package. Here all the variants of the command http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference#Update-Package
Let me know if you found this useful I'm curious to know if it just happened to me accidentally
A new version of ASP.NET was released. Announcement here : http://blogs.msdn.com/b/webdev/archive/2014/01/20/announcing-the-release-of-asp-net-mvc-5-1-asp-net-web-api-2-1-and-asp-net-web-pages-3-1.aspx
You probably have two projects in your solution, where project A references project B. Both projects reference ASP.NET, but there is a version mismatch.
I had a very similar problem to yours exactly with a reference to System.Web.Http and have documented it here:
Could not load assembly error
When you update a Nuget package it would update dependent packages. But it would not update other packages in your solution that depend on the updated packages. These other packages might not even have a newer version built with the udpated packages.
So the solution is either to udpate all your packages like you did (this might not always work) or add binding redirects to the latest version of your assembly reference to your application config.
I solved this way. As I currently have fwk 4.0.0.0 and don't want to install 5.X:
I removed the referenced DLLs
I removed a couple of bindingRedirects at packages.config,
Then I rebuilded that solution, that throws me errors
Then I added the reference again
And voilĂ , the solution is running with the fwk that I have.

Resources