Can I add a 4.5 project inside a solution with only 4.0 projects?
Example:
-ProductSolution
-Product.Domain.csproj (4.0)
-Product.Web.csproj (4.0)
-Product.WebApi.csproj (4.5)
I can't migrate my projects right now. And I want to add an Web Api and reference it to my Product.Domain project.
Thanks for any help.
You can have projects with multiple .Net versions in a single solution under Visual Studio,
BUT, you can't refer a .Net framework 4.5 version project inside an older version's project.
.Net frameworks are not forward compatible.
So your project Product.WebApi.csproj (4.5) is based on 4.5, you can't add reference to it in Product.Domain.csproj (4.0)
You can't. A 4.0 project can't reference a 4.5 project so the end goal is unachievable.
Related
I have an existing ASP.NET Core application whose target framework is .NET 4.7.2. I would like to change it to use .net core 2.2 instead.
How to do this?
In the end, I am convinced there is no "one-click" solution and did it manually. Here is what I did
in VS 2019, create a brand new solution targeting .net core 2.2
created each project manually, added nuget packages targeted for dotnet core
copied source code files into each project
make sure the solution build and run
When I create a .NET Core 2.0 Project I have to select both .NET Core version (2.0) and a .NET Framework version (4.7). But when I edit the project, I cannot change the .NET Framework version. Why is that? I am trying to use the function app.UseRewriter(options); and it is unavailable so I am theorizing that I have the wrong .NET Framework
I guess I just needed this package
Install-Package Microsoft.AspNetCore.Rewrite -Version 2.0.1
Yes, that's a confusing GUI. That got me mad as well (like some other stuff in Visual Studio if you are used to Jetbrains-IDEs).
You have chosen an ASP.NET Core Web Application as project type. So the only target frameworks that are being offered to you are .NET Core 1.0, 1.1 and 2.0 (in case you have installed 2.0, like you did).
Chose Web -> ASP.NET Web Application (.NET Framework) to get what you want.
I have a .net solution contain many projects, all of them are .net 4.5.
I have a situation that we need to use NuGet that depend on .net 4.61, so I decided to create a new class library .net 4.61 and include this NuGet in it. Project is build with no problems. but I'm not sure is that correct or not to have a solution with some projects .net 4.5 and others 4.61 ?
Mixing projects built with different versions of the framework in a single solution is fine.
But a project build with an older version of the framework can't reference a project built with a newer version of the framework. For example a 4.6 project can't reference a 4.6.1 project.
The opposite is fine, a 4.6.1 can reference an 4.6
Here is an example from visual studio.
The 4.6 console app can reference the 4.5.1 library, but not the 4.6.1 library.
I am new to ASP.NET MVC applications and I'm building a web project in Visual Studio 2015. My project targets .Net framework 4.6. I want to know which version of ASP.NET MVC is installed with this version of the framework. I have browsed a lot and also looked for answers at the ASP.NET official website, but could not find the answer.
A relevant, but not specific, answer was found at:
https://softwareengineering.stackexchange.com/questions/157717/what-is-dependency-of-asp-net-mvc-on-net-framework-and-how-to-use-it-with-net
It would be great if someone could list the versions of ASP.NET MVC alongside the versions of the .Net framework they depend upon.
Try using Visual Studio 2017, because it is not dependent on the OS you are using or targeting.
As for your question, which version of MVC are you currently using, and what are the requirements for the project?
If you're building a website that uses Entity Framework or APIs, then I recommend using framework 4.6 and MVC 5 or Core.
According to MSDN:
Runtime Changes Runtime changes affect all apps that are running under
the .NET Framework 4.6 and that use a particular feature. Retargeting
Changes Retargeting changes affect apps that are recompiled to target
the .NET Framework 4.5, 4.5.1, or 4.5.2, or 4.6. They include: Changes
in the design-time environment. For example, build tools may emit
warnings when previously they did not. Changes in the runtime
environment. These affect only apps that specifically target the .NET
Framework 4.6. Apps that target previous versions of the .NET
Framework behave as they did when running under those versions.
I hope this helps you.
I have ASP.NET web api project created on .NET v 4.5
I later i was decided to change framework to 4.0
After changing i got an error. VS can not regognize types and namespaces althougt all required librariesare referenced.
It does not happen to newly creted test API project.
Try to check that the dlls you are referencing are for version 4.0 and not 4.5, could be you are still referencing 4.5 libraries which won't work with .net 4.