I have a post-build script for wix installer which runs a C# console application
public static void ZipInstallerFolder(string inputFolder, string exePath)
{
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(exePath);
string newVersion = fvi.FileVersion;
string outputFolder = Path.Combine(inputFolder, "IQStudio_v" + newVersion + ".zip");
Console.WriteLine("Debug outputFolder " + outputFolder);
try
{
ZipFile.CreateFromDirectory(inputFolder, outputFolder, CompressionLevel.Optimal, true);
}
catch (Exception ex)
{
Console.WriteLine("ex.message - " + ex.Message);
Console.WriteLine("ex.InnerException - " + ex.InnerException);
Console.WriteLine("ex.StackTrace - " + ex.StackTrace);
}
}
here is my exception
Debug outputFolder
D:\Tools\Tools\IPDev\Main\IQStudioSetup\bin\Release\IQStudio_v0.10.3.0.zip ex.message - The process cannot access the file 'D:\Tools\Tools\IPDev\Main\IQStudioSetup\bin\Release\IQStudio_v0.10.3.0.zip' because it is being used by another process. ex.InnerException - ex.StackTrace - at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.IO.Compression.ZipFileExtensions.DoCreateEntryFromFile(ZipArchive destination, String sourceFileName, String entryName, Nullable
1 compressionLevel) at System.IO.Compression.ZipFile.DoCreateFromDirectory(String sourceDirectoryName, String destinationArchiveFileName, Nullable
1 compressionLevel, Boolean includeBaseDirectory, Encoding entryNameEncoding) at UpdateInstallerVersion.Program.ZipInstallerFolder(String inputFolder, String exePath) in d:\Tools\Tools\IPDev\Main\UpdateInstallerVersion\Program.cs:line 97
I don't understand why is the file being used by another process?
Aucun commentaire:
Enregistrer un commentaire