1
votes

Recently, I have tried to drop support for .NET Framework target from multitargeting .NET Core 3.0 project (originally supported targets: netfx472, netcoreapp3.0 and netstandard2.1). The project uses custom MSBuild tasks that target netfx472 and netcoreapp3.0 and are loaded depending on which target is built.

While trying to remove .NET Framework target support I have dropped all netfx targets and removed the dependency on custom tasks built with MSBuild netfx target. The problem I am now facing is that despite being able to build a project for .netcoreapp3.0 and netstandard2.1 targets from the command line any attempt to build it with Visual Studio 16.3.4 or later or 16.4.2 preview fail due to being unable to load custom MSBuild tasks. The side effect of this is that Visual Studio does not support detailed IntelliSense in projects which were not built correctly (IntelliSense is reduced to a rudimentary form where only types and local variables are supported - there is no support for more complex features: member selection, expression or statement syntax helpers. Additionally, code fixes stop working.)

The problem seems to lie in the use by Visual Studio of netfx targeting MSBuild distribution which comes with Visual Studio instead of .NET Core targeting MSBuild distribution what prevents the loading of MSBuild custom tasks assemblies targeting .netcoreapp3.0 during VS initiated build.

I have failed the following issue VS 2019 v16.3.4 and v16.4.prev2 are unable to build netcoreapp3.0 projects which use custom MSBuild tools targeting netcoreapp3.0 with dotnet/project-system project, however, a suggestion for any workaround would be greatly appreciated as it would unblock my work.

1
Hi, what's the msbuild task do you mean? I know msbuild supports custom tasks which implements Itask interface or Derive from Task class, but I'm not sure if it's the same one... Could you please share a minimal, reproducible sample to help us reproduce that issue? It would make great help to do trouble-shooting :)LoLance
The library I am working on is the following: github.com/DjvuNet/DjvuNet. MSBuild custom task which is used is github.com/DjvuNet/DjvuNet/tree/master/build/tools/…Jacek Blaszczynski
Though this is not officially supported, I think an easy way to check if this issue is reproducible is to create a simple .net core 3.0 custom task assembly and consume it in a new .net core project. Somehow I meet build issue in the test process :( So I haven't succeeded to do that test, i 'll come back if I have any update..LoLance

1 Answers

0
votes

Sorry but the answer could be negative, according to the info from product team, the custom msbuild task based on .net core is not supported when building .net core projects.

It seems there's a long way to go before this feature can support pure .net core, I suggest you can try posting a feature request in DC by suggesting a feature option, it may speed up the progress to let the msbuild task support pure .net core faster. Share the link here and we who interested in it will vote for you, hope it makes some help :)