Base solution for your next web application
Open Closed

Package Microsoft.AspNetCore.App 2.10 is not compatible with net461 #7970


User avatar
0
dev1_premierpoint created

I just downloaded my first ASPNETZero application and chose ASP.NET CORE MVC & JQuery for the project type.

I let it default to v7.3.1 (latest).

I need the full .NET Framework due to some libraries the application will need to use that only work with .NET full. So, I chose .NET Framework 4.6.1.

I have been unable to build the solution because I get these two error messages on line 1 of the myproj.Web.Mvc.csproj file:

Severity Code Description Project File Line Suppression State Error NU1202 Package Microsoft.AspNetCore.App 2.1.0 is not compatible with net461 (.NETFramework,Version=v4.6.1). Package Microsoft.AspNetCore.App 2.1.0 supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1) ppolDemo.Web.Mvc C:\dev\ppolDemo\src\ppolDemo.Web.Mvc\ppolDemo.Web.Mvc.csproj 1

Severity Code Description Project File Line Suppression State Error NU1202 Package Microsoft.AspNetCore.App 2.1.0 is not compatible with net461 (.NETFramework,Version=v4.6.1) / win7-x86. Package Microsoft.AspNetCore.App 2.1.0 supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1) ppolDemo.Web.Mvc C:\dev\ppolDemo\src\ppolDemo.Web.Mvc\ppolDemo.Web.Mvc.csproj 1

I opened the project in Visual Studio 2017 Version 15.9.17. I also have Visual Studio 2019 available on my dev machine and tried it too and it gave the same results.


2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team
    1. Edit the XXX.Web.Mvc.csproj file and remove <PackageReference Include="Microsoft.AspNetCore.App" />

    2. Edit XXX.LinkHrefTagHelper.cs and XXXScriptSrcTagHelper.cs:

    XXX.LinkHrefTagHelper.cs(line 45)

    if (href.IndexOf(".min.css", StringComparison.InvariantCultureIgnoreCase) == -1 && href.IndexOf(".css", StringComparison.InvariantCultureIgnoreCase) >= 0)
    {
    	href = href.Insert(href.LastIndexOf(".css", StringComparison.InvariantCultureIgnoreCase),
    		".min");
    }
    
    

    XXXScriptSrcTagHelper.cs(line 50)

    if (href.IndexOf(".min.js", StringComparison.InvariantCultureIgnoreCase) == -1 && href.IndexOf(".js", StringComparison.InvariantCultureIgnoreCase) >= 0)
    {
    	href = href.Insert(href.LastIndexOf(".js", StringComparison.InvariantCultureIgnoreCase),
    		".min");
    }
    

    I will update Zero's project generator and code. Thanks!

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.