private bool CopyFileProperties(string targetFile, string sourceFile)
        {
            VersionResource targetVersion;

            using (var sourceInfo = new ResourceInfo())
            {
                using (var targetInfo = new ResourceInfo())
                {
                    try
                    {
                        sourceInfo.Load(sourceFile);
                        targetInfo.Load(targetFile);
                    }
                    catch (Win32Exception)
                    {
                        if (ContinueOnError)
                            return true;
                        throw;
                    }

                    VersionResource sourceVersion = sourceInfo.OfType<VersionResource>().FirstOrDefault();

                    targetVersion = targetInfo.OfType<VersionResource>().FirstOrDefault();

                    var valuesToCopy = new[] { "FileDescription", "InternalName" };

                    StringTable sourceDefaultStringTable = ((StringFileInfo)(sourceVersion["StringFileInfo"])).Default;
                    StringTable targetDefaultStringTable = ((StringFileInfo)(targetVersion["StringFileInfo"])).Default;

                    foreach (var value in valuesToCopy)
                    {
                        targetDefaultStringTable.Strings[value].Value = sourceDefaultStringTable.Strings[value].Value;
                    }
                }
            }

            try
            {
                targetVersion.SaveTo(targetFile);
            }
            catch (Win32Exception)
            {
                if (ContinueOnError)
                    return true;
                throw;
            }

            return true;
        }
        public void ChangeVersion()
        {
            var sourceFile =
                @"d:\work\personal\NDistribUnit\source\builds\Debug\Fixed.Version\Server\NDistribUnit.Server.exe";

            var targetFile =
                @"d:\work\personal\NDistribUnit\source\builds\Debug\Server.exe";

            VersionResource targetVersion;

            using (var sourceInfo = new ResourceInfo())
            {
                using (var targetInfo = new ResourceInfo())
                {
                    try
                    {
                        sourceInfo.Load(sourceFile);
                        targetInfo.Load(targetFile);
                    }
                    catch (Win32Exception)
                    {
                        //                        if (ContinueOnError)
                        //                            return true;
                        throw;
                    }

                    VersionResource sourceVersion = sourceInfo.OfType<VersionResource>().FirstOrDefault();

                    targetVersion = targetInfo.OfType<VersionResource>().FirstOrDefault();

                    var valuesToCopy = new[] { "FileDescription", "InternalName" };

                    StringTable sourceDefaultStringTable = ((StringFileInfo)(sourceVersion["StringFileInfo"])).Default;
                    StringTable targetDefaultStringTable = ((StringFileInfo)(targetVersion["StringFileInfo"])).Default;

                    foreach (var value in valuesToCopy)
                    {
                        targetDefaultStringTable.Strings[value].Value = sourceDefaultStringTable.Strings[value].Value;
                    }
                }
            }

            targetVersion.SaveTo(targetFile);
        }