C++/CLI targeting .net core (.net 6)
When trying to make a new c++/cli project to target .net core instead of .net framework, or when changing an existing project to target it, it gives error when applying the setting. I've tried all different possible configurations on the project and it keeps on the same problem, I just cannot target the .net core on it.

@jkoritzinsky can you help with this?
Does this occur with any .NET project or just C++/CLI?
Does this occur with any .NET project or just C++/CLI?
This only happens when i try building an C++/CLI using netcore, if i use net framework it goes fine, and if i try to use c# it also goes fine.
I'm not sure why the correct MSBuild files aren't being included.
@wli3 can you tag the C++ project system on this issue so they can take a look?
@olgaark
Apparently, Microsoft.NET.ILLink.targets are using a property for the task location which is not defined in vcxproj, which imports common msbuild props/targets, but not c# ones. Run msbuild /pp on a c# project to see where this property is defined.
@agocke
up up.
This was probably fixed by https://github.com/dotnet/sdk/issues/16725
@HKunogi Can you try pulling a copy of the Preview 4 SDK from https://github.com/dotnet/installer and try your scenario again? Preview 4 should be available very soon.
@olgaark It looks like the root cause is the SDK targets are imported, but not the props. https://github.com/dotnet/sdk/issues/16725#issuecomment-813456887 Is there a particular reason for this? Importing the targets and not the props is likely to cause these types of failures.
VC projects are importing what SDK people told us to import, I don't know the reason. If we need to import more, just let us know.
@sbomer, who originally found the difference @wli3 Can you elaborate on why the guidance would be to import one and not the other?
C++/CLI does not support nuget restore yet. So any props and target require that to work will not be imported. You can try to add that to part of the import (search for '$(Language)' != 'C++') and then test. If it works you start to include that props or targets.
any updates?! it seems VS2022 C++ clr can't target .net 6
.net 5 End of support is May 08, 2022
but now VS 2022 C++ clr still doesn't support .NET 6!!!!!!
There is only .net core 3.1 and .net 5, still no .net 6 support now!!
This issue was previously describing a problem with C++/CLI colliding with the ILLink targets. That issue is now fixed. This appears to be a different problem. I'm opening a new issue for it.
Actually, this appears to be specific to Visual Studio -- please open a VS feedback issue if you are having issues with Visual Studio.