Esempio n. 1
0
        /// <summary>
        /// Remove reference from project
        /// </summary>
        /// <param name="displayNameOrPath">Assembly name like System.Xml which can be used for search or full path assembly</param>
        public void RemoveReference(string displayNameOrPath)
        {
            // we need to find metadata reference to get Display property with assembly full path, and then we can remove it
            var newReference      = LanguageService.CreateMetadataReference(displayNameOrPath);
            var existingReference = Compilation.References.FirstOrDefault(r => r.Display == newReference.Display);

            Compilation = Compilation.RemoveReferences(existingReference);
        }
Esempio n. 2
0
        /// <summary>
        /// Add reference to the project
        /// </summary>
        /// <param name="displayNameOrPath">Assembly name like System.Xml which can be used for search or full path assembly</param>
        public void AddReference(string displayNameOrPath)
        {
            var reference = LanguageService.CreateMetadataReference(displayNameOrPath);

            Compilation = Compilation.AddReferences(reference);
        }