question

RueckertAndreas-6220 avatar image
0 Votes"
RueckertAndreas-6220 asked PengGe-MSFT commented

The "Example" task could not be loaded from the assembly

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?

dotnet-csharpvs-msbuild
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @RueckertAndreas-6220
I have not heard from you for a couple of days. Please let me know if there is anything that I can help here.

0 Votes 0 ·

1 Answer

PengGe-MSFT avatar image
0 Votes"
PengGe-MSFT answered

Hi @RueckertAndreas-6220

Welcome to Microsoft Q&A!

You can try to Restore the nuges package.

Sincerely,
Peng


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.