Skip to content
This repository was archived by the owner on Sep 17, 2020. It is now read-only.
This repository was archived by the owner on Sep 17, 2020. It is now read-only.

Possible bug while loading external .dll #18

@eduherminio

Description

@eduherminio

Back to my original example, I still can't make this task work.

I'm not sure whether this represents an issue of RoslynCodeTaskFactory, but a different behaviour is observed when compiling from VS (it fails, trying to load net46 .dll) and from cli (it also fails, but trying to load netstandard1.5 .dll instead), while it works when using VS built-in CodeTaskFactory.

<UsingTask TaskName="ZipDir" TaskFactory="CodeTaskFactory" AssemblyFile="$(RoslynCodeTaskFactory)" Condition=" '$(RoslynCodeTaskFactory)' != '' ">
    <ParameterGroup>
      <InputBaseDirectory ParameterType="System.String" Required="true" />
      <OutputFileName ParameterType="System.String" Required="true" />
      <OverwriteExistingFile ParameterType="System.Boolean" Required="false" />
      <IncludeBaseDirectory ParameterType="System.Boolean" Required="false" />
    </ParameterGroup>
    <Task>
      <Reference Include="System.IO.Compression" />
      <Reference Include="System.IO.Compression.FileSystem" />
      <Using Namespace="System.IO.Compression" />
      <Code Type="Fragment" Language="cs">
        <![CDATA[        
        if (File.Exists(OutputFileName))
        {
            if (!OverwriteExistingFile)
            {
                return false;
            }
            File.Delete(OutputFileName);
        }
        ZipFile.CreateFromDirectory
        (
            InputBaseDirectory, OutputFileName, 
            CompressionLevel.Optimal, IncludeBaseDirectory
        );
      ]]>
      </Code>
    </Task>
  </UsingTask>

To invoke it:

  <Target Name="Bug_Reproduction" AfterTargets="Build">
    <ZipDir InputBaseDirectory="bin" OutputFileName="folder.zip" OverwriteExistingFile="true"></ZipDir>
  </Target>

Full example can be found here (tested with v1.2.1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions