Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8885599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:20:55+00:00 2026-06-14T21:20:55+00:00

I feel like I’ve fixed this before, but I can’t remember how. I have

  • 0

I feel like I’ve fixed this before, but I can’t remember how.

I have a tasks file that looks like this (CustomTasks.tasks):

<UsingTask AssemblyFile="CustomTasks.dll" TaskName="MyCustomTask"/>

it references an assembly (namely Ionic.Zip.dll). Ionic.Zip.dll is not in the GAC (and I don’t want it to be). It sits right next to my CustomTasks.dll.

I have a directory called MSBuild one level up from my sln file which has CustomTasks.tasks, CustomTasks.dll and Ionic.Zip.dll in it.

I have a csproj that references the tasks file and calls the custom task:

<Import Project="$(ProjectDir)\..\MSBuild\CustomTasks.tasks" />

<MyCustomTask ..... />

at build time, this yields:

The “MyCustomTask” task could not be loaded from the assembly ….MyCustomTasks.dll. Could not load file or assembly ‘Ionic.Zip,……’ or one of its dependencies.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:20:56+00:00Added an answer on June 14, 2026 at 9:20 pm

    Got tired and frustrated and took a direct approach…I don’t think this is the same way I solved the problem previously…but maybe this will help someone else. Other, more elegant solutions are more than welcome.

      <Target Name="BeforeBeforeBuild" BeforeTargets="BeforeBuild">
        <HandleAssemblyResolve SearchPath="$(ProjectDir)\..\MSBuild\" />
      </Target>
      <UsingTask TaskName="HandleAssemblyResolve" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
        <ParameterGroup>
          <SearchPath ParameterType="System.String" Required="true" />
        </ParameterGroup>
        <Task>
          <Using Namespace="System" />
          <Using Namespace="System.IO" />
          <Using Namespace="System.Reflection" />
          <Code Type="Fragment" Language="cs">
            <![CDATA[
    AppDomain.CurrentDomain.AssemblyResolve += (sender, e) => 
    { 
      var assemblySearchPath = Path.Combine(SearchPath, e.Name.Split(',')[0]);
      if (File.Exists(assemblySearchPath)) return Assembly.LoadFrom(assemblySearchPath);
    
      return null;
    };
    ]]>
          </Code>
        </Task>
      </UsingTask>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I feel like this question ought to have been covered, but I can't seem
I feel like this should have a simple answer, but I can't find it.
I feel like I've only ever seen this here on SO, but I can't
I feel like I've read a question similar to this but I can't find
I feel like this should be simple, but can't figure it out: What's the
I feel like this is a very noob question.. but I just can't get
Feel like this should be something easy that I'm missing. I have a table
I feel like this one has been asked before, but I'm unable to find
I feel like there's something about grids that I'm missing, but I can't find
I feel like I'm way overthinking this problem, but here goes anyway... I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.