コード例 #1
0
ファイル: AssembleTask.cs プロジェクト: formist/LinkMe
        protected Artifact CreateArtifact(string sourcePath, string projectRelativePath, IDictionary metadata)
        {
            var artifact = new Artifact(projectRelativePath);

            // Set metadata appropriately.

            foreach (DictionaryEntry entry in metadata)
            {
                switch (entry.Key as string)
                {
                case Constants.Project.Item.Assemble.InstallInGac.Name:
                    artifact.SetMetadata(Constants.Catalogue.Artifact.InstallInGac, System.Convert.ToBoolean(entry.Value as string));
                    break;

                case Constants.Project.Item.Assemble.GacGuid.Name:
                    artifact.SetMetadata(Constants.Catalogue.Artifact.GacGuid, entry.Value as string);
                    break;

                case Constants.Project.Item.Assemble.Guid.Name:
                    artifact.SetMetadata(Constants.Catalogue.Artifact.Guid, entry.Value as string);
                    break;

                case Constants.Project.Item.Assemble.ShortcutName.Name:
                    artifact.SetMetadata(Constants.Catalogue.Artifact.ShortcutName, entry.Value as string);
                    break;

                case Constants.Project.Item.Assemble.ShortcutPath.Name:
                    artifact.SetMetadata(Constants.Catalogue.Artifact.ShortcutPath, entry.Value as string);
                    break;

                case Constants.Project.Item.Link:

                    // Handled above.

                    break;

                default:
                    artifact.SetMetadata(entry.Key as string, entry.Value as string);
                    break;
                }
            }

            // Get the referenced assemblies.

            List <string> assemblies = NetUtil.GetReferencedAssemblies(GetSourceFullPath(sourcePath));

            if (assemblies != null)
            {
                foreach (string assembly in assemblies)
                {
                    artifact.AddReferencedFile(assembly + Constants.File.Dll.Extension);
                }
            }

            return(artifact);
        }