Ejemplo n.º 1
0
        public void GetLibraryExportsWithoutLockFile()
        {
            var root = Temp.CreateDirectory().CopyDirectory(Path.Combine(_testProjectsRoot, "TestAppWithLibrary"));

            foreach (var lockfile in Directory.GetFiles(root.Path, "project.lock.json"))
            {
                File.Delete(lockfile);
            }

            var builder = new ProjectContextBuilder().WithProjectDirectory(Path.Combine(root.Path, "TestApp"));

            foreach (var context in builder.BuildAllTargets())
            {
                var exporter = context.CreateExporter("Debug");
                var exports = exporter.GetAllExports();
                Assert.NotEmpty(exports);
            }
        }
Ejemplo n.º 2
0
        public void GetLibraryExportsWithoutLockFile()
        {
            var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithLibrary");

            foreach (var lockfile in Directory.GetFiles(testInstance.Path, "project.lock.json"))
            {
                File.Delete(lockfile);
            }

            var builder = new ProjectContextBuilder().WithProjectDirectory(Path.Combine(testInstance.Path, "TestApp"));

            foreach (var context in builder.BuildAllTargets())
            {
                var exporter = context.CreateExporter("Debug");
                var exports  = exporter.GetAllExports();
                Assert.NotEmpty(exports);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create Roslyn worksapces from a given project path
        /// </summary>
        public static IEnumerable <Microsoft.CodeAnalysis.Workspace> Create(string projectPath)
        {
            var builder = new ProjectContextBuilder().WithProjectDirectory(projectPath);

            return(builder.BuildAllTargets().Select(context => context.CreateRoslynWorkspace()));
        }