Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
Remove potential for NullReferenceException
Browse files Browse the repository at this point in the history
There is no need to process the paths as ITaskItem anyways.
  • Loading branch information
terrajobst committed Aug 27, 2014
1 parent 0dbc55a commit 1d749bf
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/XsdDocumentation.Build/Zip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
Expand All @@ -11,23 +10,19 @@ namespace XsdDocumentation.Build
{
public sealed class Zip : Task
{
public ITaskItem WorkingDirectory { get; set; }
public string WorkingDirectory { get; set; }

[Required]
public ITaskItem ZipFileName { get; set; }
public string ZipFileName { get; set; }

[Required]
public ITaskItem[] Files { get; set; }
public string[] Files { get; set; }

public override bool Execute()
{
try
{
var workingDirectory = WorkingDirectory.ItemSpec;
var zipFileName = ZipFileName.ItemSpec;
var fileNames = Files.Select(f => f.ItemSpec);
CreateZipArchive(workingDirectory, zipFileName, fileNames);

CreateZipArchive(WorkingDirectory, ZipFileName, Files);
}
catch (Exception ex)
{
Expand Down

0 comments on commit 1d749bf

Please sign in to comment.