コード例 #1
0
        private bool IsFiltered(ITaskItem item)
        {
            // If assembly is part of the FX then it should be filtered out...
            // System.Reflection.AssemblyName.GetAssemblyName throws if file is not an assembly.
            // We're using AssemblyIdentity.FromManagedAssembly here because it just does an
            // OpenScope and returns null if not an assembly, which is much faster.

            AssemblyIdentity identity = AssemblyIdentity.FromManagedAssembly(item.ItemSpec);

            if (identity != null && identity.IsInFramework(Constants.DotNetFrameworkIdentifier, TargetFrameworkVersion))
            {
                return(true);
            }

            // If assembly is not a "Redist Root" then it should be filtered out...
            string str = item.GetMetadata("IsRedistRoot");

            if (!String.IsNullOrEmpty(str))
            {
                bool isRedistRoot;
                if (Boolean.TryParse(str, out isRedistRoot))
                {
                    return(!isRedistRoot);
                }
            }
            return(false);
        }
コード例 #2
0
        private static bool Add(this Manifest application, Project project, string source, string target, GlobKind kind, string group = null)
        {
            if (source is null || target is null)
            {
                return(false);
            }

            if (kind == GlobKind.Assemblies &&
                application.AssemblyReferences.FindTargetPath(target) is null &&
                application.FileReferences.FindTargetPath(target) is null)
            {
                var identity = AssemblyIdentity.FromManagedAssembly(source);

                if (identity is null)
                {
                    Logger.Verbose(Messages.Build_Process_Glob_Skipped, 1, 1, source);
                    return(false);
                }

                application.AssemblyReferences.Add(new AssemblyReference
                {
                    SourcePath       = source,
                    TargetPath       = target,
                    AssemblyIdentity = AssemblyIdentity.FromFile(source),
                    IsOptional       = group != null,
                    Group            = group
                });
            }
コード例 #3
0
        private static bool IsFiltered(ITaskItem item)
        {
            bool             flag;
            AssemblyIdentity identity = AssemblyIdentity.FromManagedAssembly(item.ItemSpec);

            if ((identity != null) && identity.IsFrameworkAssembly)
            {
                return(true);
            }
            string metadata = item.GetMetadata("IsRedistRoot");

            return((!string.IsNullOrEmpty(metadata) && bool.TryParse(metadata, out flag)) && !flag);
        }
コード例 #4
0
        private static void AddEntryPoint(this ApplicationManifest application, Project project)
        {
            Logger.Normal(Messages.Build_Process_EntryPoint);

            var assembly         = project.EntryPoint.RootedPath;
            var assemblyIdentity = AssemblyIdentity.FromManagedAssembly(assembly);

            if (assemblyIdentity is null || project.UseLauncher.Value == UseLauncher.True)
            {
                if (project.UseLauncher.Value == UseLauncher.False)
                {
                    throw new ApplicationException(string.Format(Messages.Build_Exceptions_EntryPoint_NotManaged, assembly));
                }

                Logger.Normal(string.Format(Messages.Build_Process_Launcher, assembly), 1);
                assembly         = LauncherBuilder.Build(project);
                assemblyIdentity = AssemblyIdentity.FromManagedAssembly(assembly);
            }

            if (assemblyIdentity is null)
            {
                throw new ApplicationException(Messages.Build_Exceptions_EntryPoint_Failed);
            }

            var assemblyReference = new AssemblyReference(assembly.Replace(".deploy", ""))
            {
                AssemblyIdentity = assemblyIdentity,
                TargetPath       = Path.GetFileName(assembly.Replace(".deploy", ""))
            };

            if (!application.Add(project, assembly, assemblyReference.TargetPath, GlobKind.Assemblies))
            {
                throw new ApplicationException(Messages.Build_Exceptions_EntryPoint_Failed);
            }

            application.EntryPoint = assemblyReference;

            Logger.Normal();
        }