Web Api Core dependency error - c#

I am trying to open this project on my visual studio 2015:
http://www.codeproject.com/Articles/992208/Angular-JS-Application-with-MVC-Web-API-ASPNET-and
When I open the project I get the following message:
DNX SDK version '....1.0.0-beta4-11566' is required by your solution
but is not installed on this machine. Do you want to install it now?
If you select No, '...1.0.0-rc1-update1' will be used as the solution
DNX SDK Version for this session.
I choose Yes and it failed to install the DNX SDK version so it uses version 1.0.0-rc1-update1.
Then, I get this error:
The dependency Microsoft.AspNet.WebApi.Core 5.2.3 in project ... does
not support framework DNXCore, Version=v5.0.
I am running the most recent version of Visual Studio 2015 and Windows 10. I have tried updating everything, everything is up to date. I don't know why I keep getting this annoying error. I tried using different versions of the WebApi.Core from the most recent to the first version.
It's also important to mention that I am new to the whole ASP.NET 5 concept, I'm used to work with MVC 5 and under.

Related

Visual Studio Solution Explorer not showing projects in solution

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.

Cannot build .NET Framework web app targeting 4.7.2 with VS 2022 installed on a docker container

I can't successfully build basic ASP.NET web app targeting framework 4.7.2.
I built a docker image with a base image for Windows Server Core 2019. On this image I installed VS 2022 Enterprise and took Azure development, .NET desktop development, ASP.NET and web development modules, including recommended ones.
For dotnet core solutions everything works fine, but for dotnet framework I am getting such errors:
packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props(31,5): Error MSB3758: An error has occurred during compilation. error CS0014: Required file 'alink.dll' could not be found
packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props(31,5): Error MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Build.Tasks.Core.dll". The task factory must return a value for the "TaskType" property.
I additionally installed .NET Frameworks: 4.5, 4.6, 4.6.1, 4.7.1, 4.8, but it didn't help.
Locally, I am able to build it without any problems. I checked the image if VS 2022 was installed without any issues and it looks fine as well. All environment variables are also in place. I thought the issue was related with some missing .NET Frameworks with SDKs, but it still persists.
Installing Redistributable C++ 2012-2022 didn't help as well. I am using MSBuild 17.
What I still might be missing?
I want to create an agent for Azure DevOps and as a reference I use the Dockerfile from Microsoft documentation. One difference is that before the start script, I run my custom script to silently install the VS 2022 with the modules I specified earlier.
I use Azure DevOps pipelines to build the solution, and the VSBuild#1 task.
I was finally able to solve the problem I had. It turned out that the base windows server core image didn't contain all of the needed prerequisites nor Visual Studio. Solution was to use extended windows server core image with sdk 4.8. This is strange, because Visual Studio already delivers everything for sdk 4.8. I think the extended image must have had something else that didn't come with the VS installation.

Updating Visual Studio and Core 2.0

I am trying to update my project to .net core 2. But I am facing issues I have no option in the target framework to change to
I installed the .net core 2 sdk from the download site
I also tried the suggestion here but did not work for me
.NET Core 2.0 missing from my Visual Studio
But when I try to modify visual studio to install release 3 i get the following
this happens even if I click the installer and i DO NOT no why I tried various suggestions Including delete this folder
Try deleting %LocalAppData%\Microsoft\VisualStudio\Packages_Channels
But it does not exist on my pc I am running windows ten by the way
As I can see there is global.json file in your project. Try changing sdk version to 2.0.0

SonarQube binding does not work VisualStudio

I am trying to link a local ASPNET Core application to SonarQube through the team explorer connection.
My ASPNET.Core project has been recently updated to the latest version of dotnet core and also has a .csproj file. I am developing in Visual Studio 2017 with the latest version of C#.
Whenever I try to bind to my SonarQube instance (v6.1) I am prompted to authentication which I provide. Once logged in an attempt to download the compatible projects fails with the error
I also get the following output in sonarLint window
Any ideas on how I can make SonarQube recognise this project so I can bind it?
SonarLint Connected Mode is not yet available for .Net Core projects, you can track progress on GitHub issue #151 .

VS 2015 solution build fails with error some pkg not compatible with .net framework 4.5

Recently VS 2015 is not building my solution and I keep getting pkg errors like
I have following .net framework installed
I dont know whats worng , I was able to build it successfully better but after recent windows updates it's not building anymore.
I deleted the %USERPROFILE.nuget\packages directory
Then did nuget package restore and it started building successfully.

Categories

Resources