I'm trying to use a simple Default.aspx WebForm generated from a simple ASP.NET application which uses WebForms. What I did is that I just copy and paste the entire Default.aspx and Default.aspx.cs.
When I tried to build the application, it fails. I'm not sure what's wrong.
I'm curious about the DNX Core 5.0 which says the class it's not available there. What should I do? Anyways, here's my VS info:
Okay, got the problem right here. It's the project.json definition.
It seems I'm targeting multiple frameworks, just as Guruprasad said. Since I'm using WebForms, then I should use the full CLR instead of CoreCLR. Removing the "dnxcore50" did the trick.
Check your solution! If your solution has multiple projects then try setting the Target Framework of all the projects to be the same and clean and rebuild.
Related
I ran into a strange problem in my project.
This problem occurs when I want to return a specific razor view inside a method. But the point is that this problem only happens when I have used tag helpers like asp-for, otherwise there is no problem.
Error Page screenshot
First you should update your Visual Studio's installation. You can't run the latest ASP.NET core apps with the older versions. It's explained here. Take a look at its The Visual Studio / .NET Core SDK support matrix to see what's the real problem.
Also follow this thread: https://stackoverflow.com/a/44723132/298573
I am trying to build a read only .net rest api using the following tutorial on Microsoft Docs-(https://learn.microsoft.com/en-us/aspnet/web-api/overview/older-versions/build-restful-apis-with-aspnet-web-api)
According to the tutorial when i add a controller the following error popup.
I have tried other solutions on stackoverflow like
Clearing ComponentModelCache
Also deleting .vs folder in solution
But nothing helped
Try changing your project to .NET Framework instead of .NET Core and make sure you are able to create a solution with .NET Framework. If the issue still persists please provide some additional log details of VisualStudio when creating with .NET Core
I've updated my VS 2017 to newer version, and now projects on ASP.NET Core 2.1 are available to me. But there is very strange bug in C# controller code:
If you know hot to solve that problem, please, let me know.
First clean your solution by right click on solution and then built it if it still then You need to install dependencies from new get packages....this is just because of not find dependencies
Microsoft.AspNetCore.Tool
......................................SqlServer
......................................Design
Or other i forgot check if this correct it
In many projects that I and others I have there is an Ambiguous reference error that pops up if i use an object that is apart of a different asp.net5 project. Funny enough it still compiles and works but there is no intellisense and my code is covered in red lines.
An example of this is I have a Tests project pointing to my MVC project. When i try to create a new instance of XController, it will show an error that it doesnt know which XController to use the DNX 4.5.1 or DNX 5.0. I am aware of what those are but it wont let me choose, even though I feel like I shouldnt. Again, it works, just frustrating.
The only way I can get this to work is if I choose only one framework for my MVC project. I dont like doing this because I want to know if dnxcore50 doesnt support something that I am writing in the MVC app. I tried only using one framework in the unit test project but that did not work.
I want to be clear that I do understand that asp.net 5 stuff is in beta and there are many bugs. I am wondering if this is a a bug or if I am just doing something wrong.
Update 1: It seems the problem only occurs if I have a new Asp.Net 5 Class library referencing a Asp.Net 5 Mvc project. Library to library works and mvc to library also works.
After spending some time talking to the guys involved with the Asp.net 5 development team, we've come to the conclusion that this was, in my case certainly, a ReSharper issue.
If you switch off ReSharper the errors disappear.
Thanks
Looks like the solution is to only use one framework when referencing an MVC Project from another project. Seems to be just a bug.
I'm trying to upgrade from VS2010 .NET 4 to VS2012 .NET 4.5 and I'm getting the following error in each Project that I've set to .NET 4.5 when they try to build.
The expression "[Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries(.NETFramework, ?, '', '')" cannot be evaluated. Version string portion was too short or too long.
I can't find any references to this in my code and the msdn reference for the function doesn't provide any hints (http://msdn.microsoft.com/en-us/library/hh135279.aspx).
Anyone seen this before or know the solution?
Edit
The solution listed here doesn't seem to work. http://social.msdn.microsoft.com/Forums/da-DK/vseditor/thread/8ca4a9b0-742d-487d-ab8c-6c3a80cffd40
Somehow after multiple tries, including restarting the machine and visual studio, this started working for no apparent reason.
Unload your project and remove the below tag from your .csproj file:
<TargetFrameworkVersion></TargetFrameworkVersion>
and reload your project again, it works for me.
I had the same problem when upgrading from 4.6.1 to 4.7.2 framework.
I had a big solution with many projects.
This error turned out when building the last project (win application), which had the correct <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>.
The cause of the problem were the other projects, used by the win app project.
They had incorrect framework versions.