Esempio n. 1
0
        public Project(ProjectModel.Project runtimeProject)
        {
            ProjectFile = runtimeProject.ProjectFilePath;
            ProjectDirectory = runtimeProject.ProjectDirectory;

            var compilerOptions = runtimeProject.GetCompilerOptions(targetFramework: null, configurationName: null);

            var filesToWatch = new List<string>() { runtimeProject.ProjectFilePath };
            if (compilerOptions?.CompileInclude != null)
            {
                filesToWatch.AddRange(compilerOptions.CompileInclude.ResolveFiles());
            }
            else
            {
                filesToWatch.AddRange(runtimeProject.Files.SourceFiles);
            }

            if (compilerOptions?.EmbedInclude != null)
            {
                filesToWatch.AddRange(compilerOptions.EmbedInclude.ResolveFiles());
            }
            else
            {
                filesToWatch.AddRange(runtimeProject.Files.ResourceFiles.Values);
            }

            filesToWatch.AddRange(runtimeProject.Files.SharedFiles);
            filesToWatch.AddRange(runtimeProject.Files.PreprocessSourceFiles);

            Files = filesToWatch;

            var projectLockJsonPath = Path.Combine(runtimeProject.ProjectDirectory, "project.lock.json");

            if (File.Exists(projectLockJsonPath))
            {
                var lockFile = LockFileReader.Read(projectLockJsonPath, designTime: false);
                ProjectDependencies = lockFile.ProjectLibraries.Select(dep => GetProjectRelativeFullPath(dep.Path)).ToList();
            }
            else
            {
                ProjectDependencies = new string[0];
            }
        }