Пример #1
0
        static ProviderSettings getTypesProviderByProject(string projectFile)
        {
            var fs = new FS();
            var projectReferencer  = new ProjectReferencer(fs, getTypesProviderByProject);
            var assemblyReferencer = new AssemblyReferencer(fs);
            var resolver           =
                new ProjectVersionResolver(new IProvideVersionedTypes[] {
                new VersionedTypeProvider <VS2010>(
                    new IReadProjectsFor[] { new DefaultReader(fs) },
                    new IResolveFileTypes[] { getFileTypeResolver() },
                    new IAppendFiles[] { new VSFileAppender(fs) },
                    new IRemoveFiles[] { new DefaultRemover(fs) },
                    new IWriteProjectFileToDiskFor[] { new DefaultWriter() },
                    new IAddReference[]   {
                    projectReferencer, assemblyReferencer
                },
                    new IRemoveReference[] { projectReferencer, assemblyReferencer })
            });
            var project = resolver.ResolveFor(projectFile);

            if (project == null)
            {
                Console.WriteLine("error|Unsupported poject version for project {0}", projectFile);
            }
            return(new ProviderSettings(projectFile, project));
        }
Пример #2
0
 static ProviderSettings getTypesProviderByProject(string projectFile)
 {
     var fs = new FS();
     var projectReferencer = new ProjectReferencer(fs, getTypesProviderByProject);
     var assemblyReferencer = new AssemblyReferencer(fs);
     var resolver =
         new ProjectVersionResolver(new IProvideVersionedTypes[] {
                 new VersionedTypeProvider<VS2010>(
                     new IReadProjectsFor[] { new DefaultReader(fs) },
                     new IResolveFileTypes[] { getFileTypeResolver() },
                     new IAppendFiles[] { new VSFileAppender(fs) },
                     new IRemoveFiles[] { new DefaultRemover(fs) },
                     new IWriteProjectFileToDiskFor[] { new DefaultWriter() },
                     new IAddReference[] { projectReferencer, assemblyReferencer },
                     new IRemoveReference[] { projectReferencer, assemblyReferencer })
             });
     var project = resolver.ResolveFor(projectFile);
     if (project == null)
         Console.WriteLine("Unsupported poject version for project {0}", projectFile);
     return new ProviderSettings(projectFile, project);
 }