I am trying to create a Microsoft.Build.Framework.ITask-implementation which shall be used to perform some tasks at design time of another project ("Main") in VS.
The task is defined via
<UsingTask TaskName="Example.ZebusTask" AssemblyFile="D:\Example\bin\Release\net5.0\Example.dll" />
in the csproj-file of the Main project, and called via
<Target Name="GenerateMessage" BeforeTargets="CompileDesignTime">
<ZebusTask InputFiles="@(Messages)" />
</Target>
where the Messages are defined by other item groups.
Building the task succeeds with no errors, but there is an error for the main project which I cannot resolve:
The "Example.ZebusTask" task could not be loaded from the assembly
D:\Example\bin\Release\net5.0\Example.dll. Could not load file or assembly
'file:///D:\Example\bin\Release\net5.0\Example.dll' or one of its dependencies. The system
cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the
assembly and all its dependencies are available, and that the task contains a public class
that implements Microsoft.Build.Framework.ITask.
Using the Dependencies-tool, I noticed that at least two referenced dlls are missing in the Example.dll, one of them is Microsoft.Build.Utilities.Core. However, it is properly referenced in the Example.csproj.
I do not understand why the dll is incomplete but the build process does not throw an error. I also do not understand why the dll is missing in the first place. The documentation and build messages did not help, how can I further try to resolve this problem?