protected void ValidateProject(ValidationContext context) { if (Type != ArtifactType.Project) { return; } string msg = "Assembly name is not valid for the artifact {0} in the layer {1}."; bool isValid = false; try { IShellHelper shell = ServiceLocator.Instance.GetService <IShellHelper>(); if (shell != null) { isValid = shell.FindProjectByAssemblyName(InitialFileName) != null; } } catch (Exception ex) { msg = ex.Message; } if (!isValid) { AbstractLayer layer = LayerHasArtifacts.GetLayer(this); string layerName = layer != null ? layer.Name : "???"; context.LogError( String.Format(msg, FileName, layerName), "ERRART1", // Unique error number this); } }
/// <summary> /// Gets the references. /// </summary> /// <param name="context">The context.</param> /// <returns></returns> public virtual System.Collections.Generic.IEnumerable <ReferenceItem> GetReferences(ReferenceContext context) { // Liste des références externes à partir de cette couche if (context.Scope != ReferenceScope.Publish) { // Sockage temporaire du lien entre le composant externe et ses ports utilisés Dictionary <ExternalComponent, LinkDef> candidates = new Dictionary <ExternalComponent, LinkDef>(); IList <ExternalServiceReference> externalServiceLinks = ExternalServiceReference.GetLinksToExternalServiceReferences(this); foreach (ExternalServiceReference link in externalServiceLinks) { if (context.Mode.CheckConfigurationMode(link.ConfigurationMode)) { if (context.Scope == ReferenceScope.All || ( ((context.Scope == ReferenceScope.Runtime && !link.ExternalPublicPort.IsInGac) || context.Scope == ReferenceScope.Compilation) && context.CheckScope(link.Scope)) ) { LinkDef def; if (!candidates.TryGetValue(link.ExternalPublicPort.Parent, out def)) { def.Ports = new List <Guid>(); def.Scope = link.Scope; candidates.Add(link.ExternalPublicPort.Parent, def); } def.Ports.Add(link.ExternalPublicPort.ComponentPortMoniker); } } } foreach (ExternalComponent externalComponent in candidates.Keys) { LinkDef def = candidates[externalComponent]; ReferenceItem ri = new ReferenceItem(this, externalComponent, def.Scope, def.Ports, context.IsExternal); yield return(ri); } } // Liste des artifacts IList <LayerHasArtifacts> artifactsLinks = LayerHasArtifacts.GetLinksToArtifacts(this); foreach (LayerHasArtifacts link in artifactsLinks) { if (context.Mode.CheckConfigurationMode(link.Artifact.ConfigurationMode) && context.CheckScope(link.Artifact.Scope)) { yield return(new ReferenceItem(this, link.Artifact, link.Artifact.Scope, context.IsExternal)); } } }