Skip to content

Fix DotNetCoreCLI@2 zipAfterPublish to preserve ZIP file location #21045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented May 22, 2025

Issue

When using the DotNetCoreCLI@2 task with zipAfterPublish set to true, the task was removing the produced ZIP file from its original location and placing it inside a newly created directory with the same name as the output path. This resulted in a confusing directory structure where the artifact was an empty folder containing a ZIP file, rather than just the ZIP file itself.

Solution

The fix removes the unnecessary directory creation and file moving logic in the zipAfterPublishIfRequired method:

// Old behavior - created unnecessary directory structure
if (moveZipToOutputSource) {
    fs.mkdirSync(outputSource);
    fs.renameSync(outputTarget, path.join(outputSource, path.basename(outputTarget)));
}

Now when zipAfterPublish is true, the ZIP file remains at the original location where it was created, resulting in a simpler and more intuitive output.

Testing

Created a new test case to ensure the zipAfterPublish functionality works as expected.

Fixes #20974.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.fwupd.org
    • Triggering command: /usr/bin/fwupdmgr refresh (dns block)
  • pkgs.dev.azure.com
    • Triggering command: npm install (dns block)
    • Triggering command: npm install @types/node @types/mocha @types/q @types/ltx @types/uuid @types/semver (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] [BUG]: DotNetCoreCLI@2 publish removes the produced ZIP file and leaves the ZIP source files in place Fix DotNetCoreCLI@2 zipAfterPublish to preserve ZIP file location May 22, 2025
@Copilot Copilot AI requested a review from sanjuyadav24 May 22, 2025 12:59
Copilot finished work on behalf of sanjuyadav24 May 22, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: DotNetCoreCLI@2 publish removes the produced ZIP file and leaves the ZIP source files in place
2 participants