How to open an old MVC project moved on another computer? - c#

I have reinstalled my windows and I had an old project in Visual Studio MVC 5.
Now when I try to open it I get the following error:
enter image description here

You are missing a .NET project package which's name is CodeAnalysis.Csharp.
Try to install it through NuGet console package manager. Write the following command:
Install-Package Microsoft.CodeAnalysis.CSharp
If you already have that package, but older one, you might wanna do this:
Update-Package Microsoft.CodeAnalysis.CSharp
How to arrive to the console package manager?
On visual studio click:
Tools>NuGet Package Manager>Package Manager Console.
Hope it helps.

Related

Emgu error when trying to install emgu.CV.runtime.windows in VC# 2017

I'm trying to install emgu.CV.runtime.windows from within Visual Studio 2017, and installing by the recommeded method of right-clicking references and installing via NuGet.
However I am getting the error below.
Could not install package 'Emgu.runtime.windows.msvc.rt.x64 19.28.29336'. You are trying to install this package into a project that targets .NETFramework,Version=v4.7.2, but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
According to the package information, its dependencies are
enter code here.NetStandardVersion=2.0
enter code here.Engu.CV (> 4.5.1 && < 4.5.2)
enter code here.Engu.runtime.windows.msvc.rt.x86 (= 19.28.29336)
enter code here.Engu.runtime.windows.msvc.rt.x64 (= 19.28.29336)
I checked and c:\windows\Microsoft.NET\Framework contains a folder for v2.0.50727, so it seem .net 2.0 is installed (as is v3.0, v3.5, v4.0.30319)
I have emgu.CV 4.5.1.4349 installed.
I need this library so that I can have the enter code herebitmap.ToImage<Bgr, byte>(); function.
Why am I getting this error?
Any help would be greatly appreciated.
The solution is migrating from package.config to package references for every project you have. Simply right click on package.config and click "migrate package.config to PackageReference".
Then, install the runtime package again and it will work.
For the new Emgu Nuget package you do need to use PackageReference instead of the traditional package.config.
What worked for me on Visual Studio 2017:
Uninstall all NuGet Packages [This removes the package.config file]
Go to Tools --> Options --> NuGet Package Manager --> General
Change the default package management format to "PackageReference"
Check "allow format selection on first package install"
Click OK
Install Emgu.CV, Emgu.CV.Bitmap, Emgu.CV.UI and Emgu.CV.runtime.windows
These Emgu packages should now appear under your references and you should not see a package.config file.
Nuget Options Image
I encountered the same error. I don't know why we're getting it, but I was able to find a workaround.
Visit the nuget page for the package.
Click "Download Package" to download the nuget package directly.
Open the downloaded file using your archive utility of choice and navigate to the "\runtimes\win-x64\native" folder.
Copy both dll files into the output directory of your project.
After doing this, my code executed without error. Make sure to install emgu.CV.Bitmap as well.
I changed my projects Target Framework to ".NET Framework 4.6" and then went to "Manage NuGet Packages", selected "Browse", typed in "emgu.cv.runtime" then installed version 4.5.1.4349 and it worked.
Here is how I solved it,
1- downgrade .Net framework to 4.6 from project properties
2- Uninstall Emgu.CV and related ones (you will see which ones needed to be uninstalled in Errors List)
3- Install Emgu.CV.runtime.windows from Solution Nuget Manager ( it should install fine now)
3- upgrade .Net framework to 4.8
4- install Emgu.CV 4.5.1 (latest)
5- install Emgu.CV.UI 4.5.1 (Emgu.CV.Bitmwp was installed automatically for me)
and that's it, now you can use bitmap.ToImage<Bgr,Byte>(), note that the Image<Bgr,byte>(bitmap) doesn't work anymore.

Enable C# 6.0 in Visual Studio 2012 on an offline PC

I have read the answers at
C# 6.0 Support in Visual Studio 2012
however it's not clear how to get it done on an offline PC.
I have downloaded the latest stable version of the C# compiler available at
https://www.nuget.org/packages/Microsoft.Net.Compilers/
but I'm clueless of what do I do with the dowloaded nuget package, best I could do was rename it to .zip and extract it but I got stuck again not know how do I reference that in Visual Studio 2012.
Also I have no idea how to upgrade Nugetto the latest version (as outlined in that answer) before I do the other steps?
You will have to use a computer that have internet access to retrieve the nuget package and copy it the the offline computer.
Visit Nuget Site for the package you need .https://www.nuget.org/packages/Microsoft.Net.Compilers/
Click the download package link on the page
Use the nuget command-line interface to add the project to project file. For example: nuget add -Source some/directory my.nupkg
Put your downloaded packages in a folder and use it as your package source.
https://learn.microsoft.com/en-us/nuget/hosting-packages/local-feeds
You need to add the nuget package use the package manager console.
Install-Package SomePackage -Source C:\PathToThePackageDir\
Hope this helps.

Problem installing monogame.extended package

I am having a problem installing monogame extended while running
Install-Package MonoGame.Extended
at nuget console.
I get this error :
unable to find package "Monogame.Extended"
I am using visual studio community 2017,
I have already opened a new monogame project.
Try searching for it manually, click on Project -> Manage Nuget Packages.
Then Browse and type in "Monogame.Extended"
You can also install it from here.

Getting NUnit working under Visual Studio Community 2017

I'm new to NUnit and am trying to start using it under Visual Studio Community 2017; I'm having a very difficult time getting up and running.
The actual install of NUnit went well. I followed the procedure (option 1) at the Installation page on the NUnit wiki to add NUnit and NUnit.console, and now have those (and NUnit.ConsoleRunner and a handful of NUnit.Extension.* extensions) in the solution.
The NUnit wiki's .NET Core and .NET Standard page says that next is to install the NUnit template, and here's where I get stuck. It says "Run dotnet new -i NUnit3.DotNetNew.Template to install the NUnit templates." I don't seem to have a dotnet.exe anywhere on my system. Looking at Where is the dotnet command executable located on Windows? it looks like the way to get that is to install Microsoft.EntityFrameworkCore.Tools, which led me to https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/ . Based on that I tried Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.0.1 from the Package Manager Console; but that gives me the errors:
PM> Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.0.1
Install-Package : Could not install package
'Microsoft.EntityFrameworkCore.Tools 2.0.1'. You are trying to install this
package into a project that targets '.NETFramework,Version=v4.5', but the
package does not contain any assembly references or content files that are
compatible with that framework. For more information, contact the package
author.
So I'm really going down a rabbit-hole here, from NUnit3.DotNetNew.Template to to dotnet.exe to Microsoft.EntityFrameworkCore.Tools 2.0.1. Any ideas what to try next?
You were looking in the wrong place.
To get the dotnet.exe (which is not installed by VS2017 out of the box) you need to donwload and install the .NET Core SDK from https://www.microsoft.com/net/download/windows
You need to select the option: .NET Core SDK
.NET Core SDK
Cross-platform .NET implementation. The smallest download to build .NET apps, using command line tools and any editor.
In case this may be of any help to someone: in Visual Studio Community 2017, you can install "NUnit VS Template" from the main menu as follows:
Go to: Tools > Extensions and Updates > Online
Searh for 'nunit'
Click the nunit package you need, and then 'install' on the lateral panel.
You may need to close and reopen VS 2017
Hope it helps

Unable to find version '5.0.0.0' of package 'entity framework'

I am trying to install Entity Framework for MVC application.But I am getting following error:
Install-Package : Unable to find version '5.0.0.0' of package 'entityframework'
I was struck with the same issue and the below steps resolved the problem
Right click on the Project which throws the Nuget error
Select Manage NuGet Packages..
Click on Settings button in the bottom left corner
Under Available package sources,Select the checkbox nuget.org
Click on OK.
Now the packages will be automatically downloaded from the site.
Try installing the package by right-clicking on the project in visual studio -> 'Manage NuGet Packages' and search for EntityFramework.
Entity framework 5 is uploaded without the latest 0 on the version.
This should work
Install-Package EntityFramework -Version 5.0.0
For other versions look here
http://www.nuget.org/packages/EntityFramework/
It Worked .I went to http://www.nuget.org/packages/EntityFramework and then installed NuGet using Visual Studio Extension Manager and then in the console window I gave command Install-Package EntityFramework -Version 5.0.0 and it worked out.
I faced same issue. When i checked my proxy and made sure that internet connection is fine and has a reach over NuGet links, restarting VS later solved my problem.

Categories

Resources