Beispiel #1
0
        private void UpdateAssemblyReference(AssemblyReference a, string targetFrameworkVersion)
        {
            if (a.IsVirtual)
            {
                return;
            }

            if (a.AssemblyIdentity == null)
            {
                switch (a.ReferenceType)
                {
                case AssemblyReferenceType.ClickOnceManifest:
                    a.AssemblyIdentity = AssemblyIdentity.FromManifest(a.ResolvedPath);
                    break;

                case AssemblyReferenceType.ManagedAssembly:
                    a.AssemblyIdentity = AssemblyIdentity.FromManagedAssembly(a.ResolvedPath);
                    break;

                case AssemblyReferenceType.NativeAssembly:
                    a.AssemblyIdentity = AssemblyIdentity.FromNativeAssembly(a.ResolvedPath);
                    break;

                default:
                    a.AssemblyIdentity = AssemblyIdentity.FromFile(a.ResolvedPath);
                    break;
                }
            }
            if (!a.IsPrerequisite)
            {
                UpdateFileReference(a, targetFrameworkVersion);
            }

            // If unspecified assembly type then let's figure out what it actually is...
            if (a.ReferenceType == AssemblyReferenceType.Unspecified)
            {
                // a ClickOnce deployment manifest can only refer to a ClickOnce application manifest...
                if (this is DeployManifest)
                {
                    a.ReferenceType = AssemblyReferenceType.ClickOnceManifest;
                }
                // otherwise it can only be either a managed or a native assembly, but we can only tell if we have the path...
                else if (!String.IsNullOrEmpty(a.ResolvedPath))
                {
                    if (PathUtil.IsNativeAssembly(a.ResolvedPath))
                    {
                        a.ReferenceType = AssemblyReferenceType.NativeAssembly;
                    }
                    else
                    {
                        a.ReferenceType = AssemblyReferenceType.ManagedAssembly;
                    }
                }
                // there's one other way we can tell, Type="win32" references are always native...
                else if (a.AssemblyIdentity != null && String.Equals(a.AssemblyIdentity.Type, "win32", StringComparison.OrdinalIgnoreCase))
                {
                    a.ReferenceType = AssemblyReferenceType.NativeAssembly;
                }
            }
        }
        private void UpdateAssemblyReference(AssemblyReference a)
        {
            if (a.IsVirtual)
            {
                return;
            }
            if (a.AssemblyIdentity == null)
            {
                switch (a.ReferenceType)
                {
                case AssemblyReferenceType.ClickOnceManifest:
                    a.AssemblyIdentity = Microsoft.Build.Tasks.Deployment.ManifestUtilities.AssemblyIdentity.FromManifest(a.ResolvedPath);
                    goto Label_0078;

                case AssemblyReferenceType.ManagedAssembly:
                    a.AssemblyIdentity = Microsoft.Build.Tasks.Deployment.ManifestUtilities.AssemblyIdentity.FromManagedAssembly(a.ResolvedPath);
                    goto Label_0078;

                case AssemblyReferenceType.NativeAssembly:
                    a.AssemblyIdentity = Microsoft.Build.Tasks.Deployment.ManifestUtilities.AssemblyIdentity.FromNativeAssembly(a.ResolvedPath);
                    goto Label_0078;
                }
                a.AssemblyIdentity = Microsoft.Build.Tasks.Deployment.ManifestUtilities.AssemblyIdentity.FromFile(a.ResolvedPath);
            }
Label_0078:
            if (!a.IsPrerequisite)
            {
                UpdateFileReference(a);
            }
            if (a.ReferenceType == AssemblyReferenceType.Unspecified)
            {
                if (this is DeployManifest)
                {
                    a.ReferenceType = AssemblyReferenceType.ClickOnceManifest;
                }
                else if (!string.IsNullOrEmpty(a.ResolvedPath))
                {
                    if (PathUtil.IsNativeAssembly(a.ResolvedPath))
                    {
                        a.ReferenceType = AssemblyReferenceType.NativeAssembly;
                    }
                    else
                    {
                        a.ReferenceType = AssemblyReferenceType.ManagedAssembly;
                    }
                }
                else if ((a.AssemblyIdentity != null) && string.Equals(a.AssemblyIdentity.Type, "win32", StringComparison.OrdinalIgnoreCase))
                {
                    a.ReferenceType = AssemblyReferenceType.NativeAssembly;
                }
            }
        }