Example #1
0
        public CSharpCompletion()
        {
            projectContent = new CSharpProjectContent();
            var assemblies = new List <Assembly>
            {
                typeof(object).Assembly,     // mscorlib
                typeof(Uri).Assembly,        // System.dll
                typeof(Enumerable).Assembly, // System.Core.dll
//					typeof(System.Xml.XmlDocument).Assembly, // System.Xml.dll
//					typeof(System.Drawing.Bitmap).Assembly, // System.Drawing.dll
//					typeof(Form).Assembly, // System.Windows.Forms.dll
//					typeof(ICSharpCode.NRefactory.TypeSystem.IProjectContent).Assembly,
            };

            var       unresolvedAssemblies = new IUnresolvedAssembly[assemblies.Count];
            Stopwatch total = Stopwatch.StartNew();

            Parallel.For(
                0, assemblies.Count,
                delegate(int i)
            {
                var loader = new CecilLoader();
                var path   = assemblies[i].Location;
                loader.DocumentationProvider = GetXmlDocumentation(assemblies[i].Location);
                unresolvedAssemblies[i]      = loader.LoadAssemblyFile(assemblies[i].Location);
            });
            Debug.WriteLine("Init project content, loading base assemblies: " + total.Elapsed);
            projectContent = projectContent.AddAssemblyReferences((IEnumerable <IUnresolvedAssembly>)unresolvedAssemblies);
        }
Example #2
0
        public Project(StructEx.Solution solution, string title, string fileName) : base(solution, title, fileName)
        {
            Files          = new List <File>();
            ProjectContent = new CSharpProjectContent();
            ResolvedReferencedAssemblies = new List <IUnresolvedAssembly>();

            ProjectContent = ProjectContent.SetAssemblyName(AssemblyName);
            ProjectContent = ProjectContent.SetProjectFileName(fileName);

            ProjectContent = ProjectContent.SetCompilerSettings(Utils.Convert.ToCompilerSettings(CompilerSettings));

            foreach (var sourceCodeFile in MsBuildProject.GetItems("Compile"))
            {
                Files.Add(new File(this, Path.Combine(MsBuildProject.DirectoryPath, sourceCodeFile.EvaluatedInclude)));
            }

            var files =
                Files.Select(f => f.UnresolvedTypeSystemForFile);

            ProjectContent = ProjectContent.AddOrUpdateFiles(files);

            foreach (var projectReference in ReferencedProjects)
            {
                ProjectContent = ProjectContent.AddAssemblyReferences(new[] { new ProjectReference(projectReference) });
            }

            ResolveAssemblies();
        }
Example #3
0
        public CSharpCompletion()
        {
            projectContent = new CSharpProjectContent();
            var assemblies = new List<Assembly>
            {
                typeof(object).Assembly, // mscorlib
                typeof(Uri).Assembly, // System.dll
                typeof(Enumerable).Assembly, // System.Core.dll
                typeof(System.Xml.XmlDocument).Assembly, // System.Xml.dll
                typeof(Sandbox.Common.ObjectBuilders.MyObjectBuilder_AdvancedDoor).Assembly, // SpaceEngineers.ObjectBuilders.dll
                typeof(SpaceEngineers.Game.ModAPI.IMyButtonPanel).Assembly, // SpaceEngineers.Game.dll
                typeof(Sandbox.MySandboxGame).Assembly, // Sandbox.Game.dll
                typeof(Sandbox.ModAPI.MyAPIGateway).Assembly, // Sandbox.Common.dll
                typeof(Sandbox.Graphics.GUI.MyGuiSandbox).Assembly, // Sandbox.Graphics.dll
                typeof(VRage.MyModelData).Assembly, // VRage.dll
                typeof(VRage.Exceptions).Assembly, // VRage.Library.dll
                typeof(VRageMath.MathHelper).Assembly, // VRage.Math
                typeof(VRage.Game.ObjectBuilders.MyObjectBuilder_EntityStat).Assembly, //VRage.Game
            };

            var unresolvedAssemblies = new IUnresolvedAssembly[assemblies.Count];
            Stopwatch total = Stopwatch.StartNew();
            Parallel.For(
                0, assemblies.Count,
                delegate(int i)
                {
                    var loader = new CecilLoader();
                    var path = assemblies[i].Location;
                    loader.DocumentationProvider = GetXmlDocumentation(assemblies[i].Location);
                    unresolvedAssemblies[i] = loader.LoadAssemblyFile(assemblies[i].Location);
                });
            Debug.WriteLine("Init project content, loading base assemblies: " + total.Elapsed);
            projectContent = projectContent.AddAssemblyReferences((IEnumerable<IUnresolvedAssembly>)unresolvedAssemblies);
        }
Example #4
0
        public CSharpProject(
            ICSharpFileFactory cSharpFileFactory,
            MicrosoftBuildProject msBuildProject,
            string title)
        {
            Title = title;

            AssemblyName = msBuildProject.AssemblyName;
            FileName     = msBuildProject.FileName;

            CompilerSettings =
                #region new CompilerSettings
                new CompilerSettings
            {
                AllowUnsafeBlocks = msBuildProject.AllowUnsafeBlocks,
                CheckForOverflow  = msBuildProject.CheckForOverflowUnderflow,
            };

            CompilerSettings.ConditionalSymbols.AddRange(msBuildProject.DefineConstants);
            #endregion

            ProjectContent = new CSharpProjectContent();
            ProjectContent = ProjectContent.SetAssemblyName(msBuildProject.AssemblyName);
            ProjectContent = ProjectContent.SetProjectFileName(msBuildProject.FileName.FullPath);
            ProjectContent = ProjectContent.SetCompilerSettings(CompilerSettings);

            Files = msBuildProject.CompiledFileNames.Select(
                f => cSharpFileFactory.BuildCSharpFile(this, new FilePath(f))).ToList();

            ProjectContent = ProjectContent.AddOrUpdateFiles(
                Files.Select(f => f.UnresolvedTypeSystemForFile));

            ProjectContent = ProjectContent.AddAssemblyReferences(msBuildProject.ReferencedAssemblies);
        }
        public CSharpCompletion()
        {
            projectContent = new CSharpProjectContent();
            var assemblies = new List<Assembly>
            {
                    typeof(object).Assembly, // mscorlib
                    typeof(Uri).Assembly, // System.dll
                    typeof(Enumerable).Assembly, // System.Core.dll
//					typeof(System.Xml.XmlDocument).Assembly, // System.Xml.dll
//					typeof(System.Drawing.Bitmap).Assembly, // System.Drawing.dll
//					typeof(Form).Assembly, // System.Windows.Forms.dll
//					typeof(ICSharpCode.NRefactory.TypeSystem.IProjectContent).Assembly,
                };

            var unresolvedAssemblies = new IUnresolvedAssembly[assemblies.Count];
            Stopwatch total = Stopwatch.StartNew();
            Parallel.For(
                0, assemblies.Count,
                delegate(int i)
                {
                    var loader = new CecilLoader();
                    var path = assemblies[i].Location;
                    loader.DocumentationProvider = GetXmlDocumentation(assemblies[i].Location);
                    unresolvedAssemblies[i] = loader.LoadAssemblyFile(assemblies[i].Location);
                });
            Debug.WriteLine("Init project content, loading base assemblies: " + total.Elapsed);
            projectContent = projectContent.AddAssemblyReferences((IEnumerable<IUnresolvedAssembly>)unresolvedAssemblies);
        }
Example #6
0
        public CSharpCompletion()
        {
            projectContent = new CSharpProjectContent();
            var assemblies = new List <Assembly>
            {
                typeof(object).Assembly,                                                     // mscorlib
                typeof(Uri).Assembly,                                                        // System.dll
                typeof(Enumerable).Assembly,                                                 // System.Core.dll
                typeof(System.Xml.XmlDocument).Assembly,                                     // System.Xml.dll
                typeof(Sandbox.Common.ObjectBuilders.MyObjectBuilder_AdvancedDoor).Assembly, // SpaceEngineers.ObjectBuilders.dll
                typeof(SpaceEngineers.Game.ModAPI.IMyButtonPanel).Assembly,                  // SpaceEngineers.Game.dll
                typeof(Sandbox.MySandboxGame).Assembly,                                      // Sandbox.Game.dll
                typeof(Sandbox.ModAPI.MyAPIGateway).Assembly,                                // Sandbox.Common.dll
                typeof(Sandbox.Graphics.GUI.MyGuiSandbox).Assembly,                          // Sandbox.Graphics.dll
                typeof(VRage.MyModelData).Assembly,                                          // VRage.dll
                typeof(VRage.Exceptions).Assembly,                                           // VRage.Library.dll
                typeof(VRageMath.MathHelper).Assembly,                                       // VRage.Math
                typeof(VRage.Game.ObjectBuilders.MyObjectBuilder_EntityStat).Assembly,       //VRage.Game
            };

            var       unresolvedAssemblies = new IUnresolvedAssembly[assemblies.Count];
            Stopwatch total = Stopwatch.StartNew();

            Parallel.For(
                0, assemblies.Count,
                delegate(int i)
            {
                var loader = new CecilLoader();
                var path   = assemblies[i].Location;
                loader.DocumentationProvider = GetXmlDocumentation(assemblies[i].Location);
                unresolvedAssemblies[i]      = loader.LoadAssemblyFile(assemblies[i].Location);
            });
            Debug.WriteLine("Init project content, loading base assemblies: " + total.Elapsed);
            projectContent = projectContent.AddAssemblyReferences((IEnumerable <IUnresolvedAssembly>)unresolvedAssemblies);
        }
Example #7
0
 private IProjectContent AddAllAssemblyReferences(CSharpSolution solution, Project msbuildProject, IProjectContent pc)
 {
     foreach (var assemblyFile in ResolveAssemblyReferences(msbuildProject))
     {
         var assembly = solution.LoadAssembly(assemblyFile);
         pc = pc.AddAssemblyReferences(new[] { assembly });
     }
     return(pc);
 }
        void Init(string program)
        {
            pc             = new CSharpProjectContent();
            pc             = pc.SetAssemblyName("MyAssembly");
            unresolvedFile = SyntaxTree.Parse(program, "program.cs").ToTypeSystem();
            pc             = pc.AddOrUpdateFiles(unresolvedFile);
            pc             = pc.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib });

            compilation = pc.CreateCompilation();
        }
Example #9
0
 public CSharpCodeCompletionStrategy(CodeEditor codeEditor)
     : base(codeEditor)
 {
     codeEditor.InternalAssembliesLoaded += (sender, args) => {
         projectContent = projectContent.AddAssemblyReferences(args.Value);
     };
     codeEditor.InternalAssembliesUnloaded += (sender, args) => {
         projectContent = projectContent.RemoveAssemblyReferences(args.Value);
     };
 }
Example #10
0
        /// <summary>
        /// Default construtor. If null is passed in, the default assemblies list will be used.
        /// </summary>
        /// <param name="assemblies"></param>
        public CSharpCompletion(IReadOnlyList <Assembly> assemblies = null)
        {
            projectContent = new CSharpProjectContent();
            if (assemblies != null)
            {
                unresolvedAssemblies = GetAssemblies(assemblies.ToList());
            }

            projectContent = projectContent.AddAssemblyReferences((IEnumerable <IUnresolvedAssembly>)unresolvedAssemblies);
        }
		void Init(string program)
		{
			pc = new CSharpProjectContent();
			pc = pc.SetAssemblyName("MyAssembly");
			unresolvedFile = SyntaxTree.Parse(program, "program.cs").ToTypeSystem();
			pc = pc.AddOrUpdateFiles(unresolvedFile);
			pc = pc.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib });
			
			compilation = pc.CreateCompilation();
		}
Example #12
0
		public MockCSharpProject(ISolution solution, string name)
			: base(new ProjectCreateInformation(solution, FileName.Create("c:\\projects\\" + name + "\\" + name + ".csproj")) {
			       	ProjectName = name,
			       	ActiveProjectConfiguration = new ConfigurationAndPlatform("Debug", "x86"),
			       	TargetFramework = TargetFramework.Net40Client,
			       })
		{
			OutputType = OutputType.Library;
			projectContent = new CSharpProjectContent().SetAssemblyName(name).SetProjectFileName(this.FileName);
			projectContent = projectContent.AddAssemblyReferences(NRefactoryHelper.Corlib);
		}
 public MockCSharpProject(ISolution solution, string name)
     : base(new ProjectCreateInformation(solution, FileName.Create("c:\\projects\\" + name + "\\" + name + ".csproj")) {
     ProjectName = name,
     ActiveProjectConfiguration = new ConfigurationAndPlatform("Debug", "x86"),
     TargetFramework            = TargetFramework.Net40Client,
 })
 {
     OutputType     = OutputType.Library;
     projectContent = new CSharpProjectContent().SetAssemblyName(name).SetProjectFileName(this.FileName);
     projectContent = projectContent.AddAssemblyReferences(NRefactoryHelper.Corlib);
 }
Example #14
0
        private static IProjectContent AddAllProjectReferences(Project msbuildProject, IProjectContent pc)
        {
            foreach (var item in msbuildProject.GetItems("ProjectReference"))
            {
                var referencedFileName = Path.Combine(msbuildProject.DirectoryPath, item.EvaluatedInclude);
                referencedFileName = Path.GetFullPath(referencedFileName);

                pc = pc.AddAssemblyReferences(new[] { new ProjectReference(referencedFileName) });
            }
            return(pc);
        }
        public static void AddAssembly(string file)
        {
            if (String.IsNullOrEmpty(file))
            {
                return;
            }

            var loader             = new CecilLoader();
            var unresolvedAssembly = loader.LoadAssemblyFile(file);

            projectContent = projectContent.AddAssemblyReferences(unresolvedAssembly);
        }
Example #16
0
        public MemberResolver(IList <ParsedSourceFile> sourceFiles, IEnumerable <IAssemblyReference> assemblies, AssemblyDefinition assemblyDefinition)
        {
            project          = null;
            lastFileName     = null;
            this.sourceFiles = sourceFiles;
            Assemblies       = assemblies;
            MainAssembly     = assemblyDefinition;
            typeSystemCache  = new ConcurrentDictionary <SyntaxTree, CSharpUnresolvedFile>();

            project = new CSharpProjectContent();
            project = project.AddAssemblyReferences(assemblies);
            project = project.SetAssemblyName(assemblyDefinition.FullName);
            AddOrUpdateFiles();
        }
Example #17
0
		public void SetUp()
		{
			pc = new CSharpProjectContent();
			pc = pc.SetAssemblyName("MyAssembly");
			parsedFile = new CSharpParser().Parse(new StringReader(program), "program.cs").ToTypeSystem();
			pc = pc.UpdateProjectContent(null, parsedFile);
			pc = pc.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib });
			
			compilation = pc.CreateCompilation();
			
			baseClass = compilation.RootNamespace.GetTypeDefinition("Base", 1);
			nestedClass = baseClass.NestedTypes.Single();
			derivedClass = compilation.RootNamespace.GetTypeDefinition("Derived", 2);
			systemClass = compilation.FindType("NS.System, MyAssembly").GetDefinition();
		}
        public void SetUp()
        {
            pc         = new CSharpProjectContent();
            pc         = pc.SetAssemblyName("MyAssembly");
            parsedFile = new CSharpParser().Parse(new StringReader(program), "program.cs").ToTypeSystem();
            pc         = pc.UpdateProjectContent(null, parsedFile);
            pc         = pc.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib });

            compilation = pc.CreateCompilation();

            baseClass    = compilation.RootNamespace.GetTypeDefinition("Base", 1);
            nestedClass  = baseClass.NestedTypes.Single();
            derivedClass = compilation.RootNamespace.GetTypeDefinition("Derived", 2);
            systemClass  = compilation.RootNamespace.GetChildNamespace("NS").GetTypeDefinition("System", 0);
        }
		public void SetUp()
		{
			pc = new CSharpProjectContent();
			pc = pc.SetAssemblyName("MyAssembly");
			unresolvedFile = SyntaxTree.Parse(program, "program.cs").ToTypeSystem();
			pc = pc.AddOrUpdateFiles(unresolvedFile);
			pc = pc.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib });
			
			compilation = pc.CreateCompilation();
			
			baseClass = compilation.RootNamespace.GetTypeDefinition("Base", 1);
			nestedClass = baseClass.NestedTypes.Single();
			derivedClass = compilation.RootNamespace.GetTypeDefinition("Derived", 2);
			systemClass = compilation.RootNamespace.GetChildNamespace("NS").GetTypeDefinition("System", 0);
		}
Example #20
0
        public Minifier(MinifierOptions options = null, string[] ignoredIdentifiers = null, string[] ignoredComments = null)
        {
            Options = options ?? new MinifierOptions();

            _projectContent = new CSharpProjectContent();
            var assemblies = new List <Assembly>
            {
                typeof(object).Assembly,                      // mscorlib
                typeof(Uri).Assembly,                         // System.dll
                typeof(Enumerable).Assembly,                  // System.Core.dll
            };

            var unresolvedAssemblies = new IUnresolvedAssembly[assemblies.Count];

            Parallel.For(
                0, assemblies.Count,
                delegate(int i)
            {
                var loader = new CecilLoader();
                var path   = assemblies[i].Location;
                unresolvedAssemblies[i] = loader.LoadAssemblyFile(assemblies[i].Location);
            });
            _projectContent = _projectContent.AddAssemblyReferences((IEnumerable <IUnresolvedAssembly>)unresolvedAssemblies);


            IgnoredIdentifiers = ignoredIdentifiers == null ? new List <string>() : ignoredIdentifiers.ToList();
            IgnoredComments    = new List <string>();
            if (ignoredComments != null)
            {
                foreach (string comment in ignoredComments)
                {
                    var str = comment;
                    if (str.StartsWith("//"))
                    {
                        str = str.Substring("//".Length);
                    }
                    else if (str.StartsWith("/*") && str.EndsWith("*/"))
                    {
                        str = str.Substring("/*".Length, str.Length - "/*".Length - "*/".Length);
                    }
                    if (!IgnoredComments.Contains(str))
                    {
                        IgnoredComments.Add(str);
                    }
                }
            }
        }
Example #21
0
        public virtual IProjectContent GetProjectContext()
        {
            if (Project == null)
            {
                if (singleFileContext == null)
                {
                    singleFileContext = new ICSharpCode.NRefactory.CSharp.CSharpProjectContent();
                    singleFileContext = singleFileContext.AddAssemblyReferences(new [] { Mscorlib, System, SystemCore });
                }
                if (parsedDocument != null)
                {
                    return(singleFileContext.AddOrUpdateFiles(parsedDocument.ParsedFile));
                }
                return(singleFileContext);
            }

            return(TypeSystemService.GetProjectContext(Project));
        }
Example #22
0
        public Minifier(MinifierOptions options = null, string[] ignoredIdentifiers = null, string[] ignoredComments = null)
        {
            Options = options ?? new MinifierOptions();

            _projectContent = new CSharpProjectContent();
            var assemblies = new List<Assembly>
                {
                    typeof(object).Assembly, // mscorlib
                    typeof(Uri).Assembly, // System.dll
                    typeof(Enumerable).Assembly, // System.Core.dll
                };

            var unresolvedAssemblies = new IUnresolvedAssembly[assemblies.Count];
            Parallel.For(
                0, assemblies.Count,
                delegate (int i)
                {
                    var loader = new CecilLoader();
                    var path = assemblies[i].Location;
                    unresolvedAssemblies[i] = loader.LoadAssemblyFile(assemblies[i].Location);
                });
            _projectContent = _projectContent.AddAssemblyReferences((IEnumerable<IUnresolvedAssembly>)unresolvedAssemblies);

            IgnoredIdentifiers = ignoredIdentifiers == null ? new List<string>() : ignoredIdentifiers.ToList();
            IgnoredComments = new List<string>();
            if (ignoredComments != null)
                foreach (var comment in ignoredComments)
                {
                    var str = comment;
                    if (str.StartsWith("//"))
                        str = str.Substring("//".Length);
                    else if (str.StartsWith("/*") && str.EndsWith("*/"))
                        str = str.Substring("/*".Length, str.Length - "/*".Length - "*/".Length);
                    if (!IgnoredComments.Contains(str))
                        IgnoredComments.Add(str);
                }
        }
Example #23
0
        private static IProjectContent AddAllProjectReferences(Project msbuildProject, IProjectContent pc)
        {
            foreach (var item in msbuildProject.GetItems("ProjectReference"))
            {
                var referencedFileName = Path.Combine(msbuildProject.DirectoryPath, item.EvaluatedInclude);
                referencedFileName = Path.GetFullPath(referencedFileName);

                pc = pc.AddAssemblyReferences(new[] {new ProjectReference(referencedFileName)});
            }
            return pc;
        }
Example #24
0
 private IProjectContent AddAllAssemblyReferences(CSharpSolution solution, Project msbuildProject, IProjectContent pc)
 {
     foreach (var assemblyFile in ResolveAssemblyReferences(msbuildProject))
     {
         var assembly = solution.LoadAssembly(assemblyFile);
         pc = pc.AddAssemblyReferences(new[] { assembly });
     }
     return pc;
 }
 public void AddAssemblyReference(IAssemblyReference reference)
 {
     projectContent = projectContent.AddAssemblyReferences(reference);
 }
Example #26
0
        public CSharpProject(
            ICSharpFileFactory cSharpFileFactory,
            MicrosoftBuildProject msBuildProject,
            string title)
        {
            Title = title;

            AssemblyName = msBuildProject.AssemblyName;
            FileName = msBuildProject.FileName;

            CompilerSettings =
                #region new CompilerSettings
                new CompilerSettings
                {
                    AllowUnsafeBlocks = msBuildProject.AllowUnsafeBlocks,
                    CheckForOverflow = msBuildProject.CheckForOverflowUnderflow,
                };

            CompilerSettings.ConditionalSymbols.AddRange(msBuildProject.DefineConstants);
            #endregion

            ProjectContent = new CSharpProjectContent();
            ProjectContent = ProjectContent.SetAssemblyName(msBuildProject.AssemblyName);
            ProjectContent = ProjectContent.SetProjectFileName(msBuildProject.FileName.FullPath);
            ProjectContent = ProjectContent.SetCompilerSettings(CompilerSettings);

            Files = msBuildProject.CompiledFileNames.Select(
                f => cSharpFileFactory.BuildCSharpFile(this, new FilePath(f))).ToList();

            ProjectContent = ProjectContent.AddOrUpdateFiles(
                Files.Select(f => f.UnresolvedTypeSystemForFile));

            ProjectContent = ProjectContent.AddAssemblyReferences(msBuildProject.ReferencedAssemblies);
        }
Example #27
0
        public CSharpProject(Solution solution, string title, string fileName)
        {
            // Normalize the file name
            fileName = Path.GetFullPath(fileName);

            _solution = solution;
            Title     = title;
            FileName  = fileName;

            // Use MSBuild to open the .csproj
            var msbuildProject = GetMSBuildProject(fileName);

            // Figure out some compiler settings
            AssemblyName = msbuildProject.GetPropertyValue("AssemblyName");
            CompilerSettings.AllowUnsafeBlocks = GetBoolProperty(msbuildProject, "AllowUnsafeBlocks") ?? false;
            CompilerSettings.CheckForOverflow  = GetBoolProperty(msbuildProject, "CheckForOverflowUnderflow") ?? false;
            string defineConstants = msbuildProject.GetPropertyValue("DefineConstants");

            foreach (string symbol in defineConstants.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
            {
                CompilerSettings.ConditionalSymbols.Add(symbol.Trim());
            }

            // Initialize the unresolved type system
            ProjectContent = new CSharpProjectContent();
            ProjectContent = ProjectContent.SetAssemblyName(AssemblyName);
            ProjectContent = ProjectContent.SetProjectFileName(fileName);
            ProjectContent = ProjectContent.SetCompilerSettings(CompilerSettings);
            // Parse the C# code files
            foreach (var item in msbuildProject.GetItems("Compile"))
            {
                AddCSharpFile(
                    new CSharpFile(this, Path.Combine(msbuildProject.DirectoryPath, item.EvaluatedInclude)));
            }

            var assemblyReferences =
                new AssemblyReferencesResolved
            {
                References = ResolveAssemblyReferences(msbuildProject).ToList()
            };

            if (null != OnAssemblyReferencesResolved)
            {
                OnAssemblyReferencesResolved(this, assemblyReferences);
            }

            // Add referenced assemblies:
            foreach (string assemblyFile in assemblyReferences.References)
            {
                IUnresolvedAssembly assembly = solution.LoadAssembly(assemblyFile);
                ProjectContent = ProjectContent.AddAssemblyReferences(new IAssemblyReference[] { assembly });
            }

            // Add project references:
            foreach (var item in msbuildProject.GetItems("ProjectReference"))
            {
                string referencedFileName = Path.Combine(msbuildProject.DirectoryPath, item.EvaluatedInclude);
                // Normalize the path; this is required to match the name with the referenced project's file name
                referencedFileName = Path.GetFullPath(referencedFileName);
                ProjectContent     = ProjectContent.AddAssemblyReferences(new IAssemblyReference[] { new ProjectReference(referencedFileName) });
            }
        }