I cannot compile a web application

I am trying to migrate several web applications that use common class libraries and I cannot compile them. With the libraries there is no problem, I have compiled them perfectly, but when I compile the web applications I get errors with all the references to the class libraries code, even the “uses” clauses.

I attach a simplified solution so that you can reproduce the problem.
Asp.net.rar (41.7 KB)
I have used the templates provided by Remobjects to build the two projects, “ASP.NET Classic Web Application” and “Class Library (Classic .NET)” that both uses .net 4.8.

I am waiting for your answer to be able to continue with the migration.

Best regards,

Hi Carlos,

What errors are you getting? I just downloaded your project, and it compiles without errors for me, here

Update: nevermind. reproduced.

Ah, the wonderful world fid MSBuild. Buried deeply in the build log when you set it to maximum detailedness is this message:

2>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2304,5): warning MSB3274: The primary reference “C:\Users\Administrator\Test Projects\Asp-1.net\ClassLibrary\Bin\Debug\ClassLibrary.dll” could not be resolved because it was built against the “.NETFramework,Version=v4.8” framework. This is a higher version than the currently targeted framework “.NETFramework,Version=v4.0”.

which, it beats me why, Microsoft thinks is n to important enough too show as waring or error in the IDE, it just ignores the reference.

Somehow it thinks the main project is building for 4.0, not 4.8

Ah, got it. The main project builds with other Legacy target (which is good, as iASP.NET needs that), but that uses MSBuild, and MSBuild apparently does not support the TargetFramework setting, but only TargetFrameworkVersion.

I’ll see how that got there (maybe a bad template), but for now the proper fix is to manually edit the project file and replace this line:


with this:


after this change, your project compiles correctly.

I’ll log an issue to check the templates and to prevent this property being able to migrated in the UI, for projects with the legacy target…

Logged as bugs://E25996.

I might have spoken too soon, it looks like VS will actively migrate this property back to the wrong one :(. If that happens to you, you might be stuck waiting for the next build where this is fixed. I’ll see if we can get that part in for tomorrow’s build, but no promises, as I cannot judge how involved this change is.

Hi Marc,

I put


, as you suggest, and it compiles perfectly, but when I look at the dll with ILSpy it says v4.0.


I’m not sure, I’m going to try with one of my applications and see what happens. I’ll keep you posted.

That’s very curious.

Logged as bugs://E25997. (for the wrong version in the exe)

I think I have this fixed (for post .2753, unfortunately), but untested.

bugs://E25996 was closed as fixed. (VS Problem with legacy target and TargetFramework setting)

bugs://E25997 was closed as fixed. (Project built with Echoes.Legacy will have be marked as 4.0 even if TargetFrameworkVersion is set higher)