Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
ASP.NET MVC 5 Razor View Errors with Multi Target Project References #2500
Comments
|
This is still an issue. Anyone have any insight into how to resolve? Thanks. |
Versions
What happened
In an effort to start migration to .NET Core, we converted our class library projects to dual target NetCore 3.1 and Full 4.7.2. We've added our dual target class libraries as project references to the 4.7.2 MVC 5 web project. Everything compiles and runs fine. However, when editing our Razor views in Visual Studio, we get .NET Core errors when referencing objects in our dual target projects. The razor view editor appears to be using the NetCore 3.1 target instead of 4.7.2... If you drill-into an object reference in the razor view, it goes to the Core 3.1 flavor of our object instead of our full framework version.
Errors like: "The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runetime, Version=4.2.2.0....'. The type 'HttpRequest' is defined in an assembly that is not referenced... 'Microsoft.AspNetCore.Http.Abstractions'. etc. All related to our web project not having .NET Core references which shouldn't be a thing.
Our web project is targeting 4.7.2. We have manually edited the web projects' project references to utilize the AdditionalProperties="TargetFramework=net472" and SetTargetFramework to TargetFramework=net472. We have 4.7.2 set in the web.config for compliation and httpRuntime.
<ProjectReference Include="..\..\..\Shared Components\.NET\xxx.Web\xxx.Web.csproj" AdditionalProperties="TargetFramework=net472"> <Project>{079c59ed-768b-4176-b189-56c8e53c329b}</Project> <Name>xxx.Web</Name> <SetTargetFramework>TargetFramework=net472</SetTargetFramework> </ProjectReference>Any help would be much appreciated. Thank you.
The text was updated successfully, but these errors were encountered: