I am working on a project on TFS. This project was created on someone else's PC on VS 2017 and the newest .NET framework and published to Azure.
I got the project on my PC, I have VS 2015 and I had to change the .NET framework of the project to 4.6. Everything was fine, I could make changes to the project and commit.
But when I tried to publish to Azure from my PC, I got a very unclear error:
Publish Failed
Connecting to ...
Looking for solutions online, I had to downgrade the version of the package Microsoft.Net.Compilers from 2.6.1 to 2.4.0 . And that worked !
I turned off my PC. Next day when I opened the project and ran it, I got this error locally :
Could not load file or assembly 'Microsoft.ApplicationInsights, Version=2.6.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I tried to uninstall Microsoft.ApplicationInsights and reinstall it with version 2.6.1 , but it says i need a newer version of nuget.
I am not sure how to proceed from here. I already installed all the updates in my Tools -> Extensions -> Updates but nothing changed.
Why are all these things happening to my project and how can i fix it?
PS: upgrading my VS to 2017 is currently not an option due to many exterior reasons.
Thank you.
I've gotten that error locally as well and was actually able to resolve by manually adding the file to my project folder, may be worth a shot.
Downgrading .NET Framework causing packages issues
Just like Hans said nuget packages change quite rapidly, which often require the latest version NuGet. Some new features in the package only supported by the newer NuGet (like PackageReference) or some issues fixed on the newer version. For example, install package Microsoft.EntityFrameworkCore.SqlServer 2.1.1 on Visual Studio 2015, which requires NuGet client version '3.6.0' or above.
So, the workaround for this issue is create a new project with Visual Studio 2015, copy the code from previous projects, then add those nuget package one by one to find out the reason why it needs the newer version nuget.
However, I want to talk more over about this question is that the best way to resolve this issue is to install Visual Studio 2017 alongside Visual Studio 2015. As we known, using a lower version of the Visual Studio and .net framework to open a higher version of the Visual Studio and .net framework is not recommended, it will always bring a lot of incompatibility errors and some other weird issues. Since upgrade your Visual Studio to 2017 is currently not an option due to many exterior reasons, so I suggest that you can install Visual Studio 2017 alongside Visual Studio 2015. Besides, developing the same project with different versions of Visual Studio and submitting it to the TFS server may bring many unpredictable risks.
Hope this helps.
Related
When I try to right click (in the Solution Explorer) and add the existing project to solution, I get the error:
The .NET Core SDK cannot be located. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path
I checked here (where they get the same error on VS Code) and tried repairing, installing, reinstalling Visual Studio and my .Net 6.0 and 7.0 SDKs. Made sure to install the SDKs even with VS not open, even after a fresh restart. Nothing worked. Plus, some of those solutions seemed specific to VS code, not VS Studio.
Not sure how relevant this detail is, but this my first attempt at installing Visual Studio on this computer.
The problem persisted regardless of project type (WPF and Console were attempted), .Net version (tried making .Net 6.0 and 7.0 apps, which are the 2 sdks I've got installed), and whether or not I indicated I wanted the project and solution in the same directory.
Those were my guesses, and nothing's worked.
Here's what it looks like when I create a new project:
Open visual studio installer and make sure you have installed .Net Framework Developer correctly.
Select .Net 6.0 on this page
Can you create a wpf .net 6 project according to this flow.
If it still doesn't work, please try the repair button in the installer.
The problem turned out to be that the SDKs weren't ordered correctly in the environment variables. C:\Program Files (x86)\dotnet was listed before C:\Program Files\dotnet. I found the solution here.
Not exactly a duplicate issue though, as issues were sort of different, but had the same fix.
A project I have been working on was upgraded from .NET Framework 4.6.2 to 4.7.2.
On build, in a file that is not my code, I get the following error:
I also see the same error in the build tab of my project properties.
I'm at a loss- I've searched for the error and am coming up empty. Has anyone encountered and/or resolved this before?
Looks like after upgrading your build tool is changed from MSBUILD to Roslyn. Microsoft.Managed.Core.targets is Roslyn target file.
if you have following Nuget packages installed:
Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Microsoft.Net.Compilers
Then possibly it's causing the issue. Upgrade the Microsoft.CodeDom.Providers.DotNetCompilerPlatform to 2.x and remove the second one. That should fix the issue.
Ran into the same error - a compatibility issue between Microsoft.Net.Compilers 2.x (vs2017) and 3.x (vs2019) - downgrading from v3 to v2 fixed the issue specifically on our build agents which only had VS2017. v3 requires VS 2019 or later per roslyn-analyzers release spec.
Per the related error Method 'System.String.GetPathsOfAllDirectoriesAbove' not found - VS2017 would not even open the CSPROJ which was a clue about compatibility.
VS 2017 - CSPROJ Option to Install Missing Features for Microsoft.Net.Compilers v3
VS 2017 - Installing Missing Features
This happned to me when I updated Microsoft.Net.Compilers in an old project.
Removing Microsoft.Net.Compilers completely, and then updating Microsoft.CodeDom.Providers.DotNetCompilerPlatform resolved my problem.
This can also happen when trying to compile a VS2019 project with an older version of Visual Studio (e.g., on a build server or in Azure DevOps).
If, after applying the solution from answer https://stackoverflow.com/a/59276492/2279059, the error changes to
##[error]CSC(0,0): Error CS1617: Invalid option '8.0' for /langversion
then this is likely the case. The solution is then to build with the right version of Visual Studio (2019).
This error usually comes when you upgrade the below libraries by nuget
Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Microsoft.Net.Compilers
Guys, If your project is not loading due to this error. just go to that project location by explorer and delete the obj folder manually.
Then right-click on the project and RELOAD AGAIN.
Here is the context :
2 persons are working on a WPF application (me and a colleague)
we both use the VS 2017 (i have the version 15.6.6 he has the version 15.6.4)
we are both using the most recent and fully updated .NET Framework
we are using MSI installation system to deploy our WPF application + Win services
we are using WIX to package all this
But something strange happened: when I generate the installer, the netstandard.dll version deployed is the 4.6.25908.2, and when he generates the installer, the netstandard.dll is the 4.6.26011.1
After some research, we discover that this dll is coming from MSBUILD, and by checking in the "Developer Command Prompt for VS 2017", using the "msbuild" command :
- my version is 15.5.180.xxxx
- his version is 15.6.6.xxxx
My question is pretty simple, what is responsible for updating msbuild package?
Obviously, not VS or .Net Framework
I have found some nugget package to add to my projects but I don't want this, I want this dll to be updated properly in "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\lib" directory
How can I manage to achieve this?
Ok I found what was going on and there was no way to find out with what I posted.
This is the story :
I installed VS 2017 Pro with a license
I tried VS 2017 Enterprise for sometimes with a trial license
VS 2017 setup made 2 distinct installations
After the trial license expired, I was still using then Enterprise installation downgraded to a Pro version
The Enterprise version was up to date but not the original Pro version
Conlusion: by updating the VS 2017 Pro version specifically, it solved my problem
#Hans Passant: the MSBUILD was indeed updated with VS 2017, but for some reason, I don't really understand, I have to update both Pro and Enterprise version to 15.6.6.xxxx in order to update MSBUILD properly
I have a solution with projects pointing to .Net Framework 4.5 which I have opened in Visual Studio 2017 and tried to Unit Test Project pointing to .Net Framework 4.5. I am getting the following error
Package Installation error .
Could not add all required packages to the project. The following packages failed to install from 'C:\Program Files(x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\502SXCIF.E5I\Packages':
MSTest.TestFramework.1.1.11: Failed to add reference to 'Microsoft.VisualStudio.TestPlatform.TestFramework'
I have tried changing the Platform to x86 as suggested on some online resources.
I am using a Windows 7 Enterprise 64 bit. Has anyone been able to resolve this.
MsUnit test related template got missed in your local system.if you have another version please try to copy respective folder it will resolve the issue.
I have a project that i cannot compile. When i try to do so I get the following error:
The 'Microsoft.Bcl.Build 1.0.14' package requires NuGet client version '2.8.1' or above, but the current NuGet version is '2.7.41115.310'.
Normally this would be simple. After searching I found this guide:
http://www.daimto.com/package-requires-nuget-client-version-x/
That explains how I can upgrade my Nuget client version. However, when i follow those steps, I find that I am already using the latest version of Nuget: 2.8.5
For some reason however, Visual Studio 2013 Ultimate is using an older version, and I don't understand why.
My install of Visual Studio Ultimate 2013 is a fresh install, after unninstalling Visual Studio for Web Express 2012. The previous version was giving me a considerable amount of problems and so I deleted it and moved on to 2013. I wonder if some cofig files were passed through, but I cant be sure.
How can I fix this problem?
From Tools → Extensions and Updates → Installed, uninstall “NuGet Package Manager” and install it again.
So, after searching around I found no answers, so I decided to look into the project folders. It happens that I have the main version of NuGet.exe, 2.8.5 in main folder, but the project was nowhere near that main folder.
This way, when I downloaded the project it simply used the NuGet version pulled from TFS (or so I assume), and that was the problem - that verison was Nuget.exe 2.7.4.
After replacing the "Nuget.exe" files (found in /.nuget folder of the project) the project finally compiled and everythign started working again.
You can also try update Nuget Package Manager directly from Tools > Extensions and Updates
In my case, a pending update of Visual Studio fixed the nuget version.
The update was the "Update 5" for VisualStudio 2013.
The update was listed under the menu Tools → Extensions and Updates, on the tab Updates.
I was getting this error from a recently cloned branch, but (in contrast to the above solution) found that my Nuget version in the project directory was the same as that in my solution directory.
I solved this by right clicking on the solution and Managing Nuget Packages for the solution. The Nuget dialog that popped up said that packages were missing and asked me to restore them. Once downloaded, the project built successfully.
I had the same issue when trying to install System.Net.Http and it said the nuget version needed to be version 3.0 or above. I tried few things but in the end, used Tools and Manage Nuget Packages and did a search and tried to install it from there when it said exactly the same thing - wrong version of nuget, but it popped up with an upgrade Nuget button too!
Hope this helps someone
Simply reinstall nuget in visual studio