Exemple #1
0
        public static async Task Main(string[] args)
        {
            if (!MSBuildLocator.IsRegistered)
            {
                MSBuildLocator.RegisterDefaults();
            }

            ProjectPath = args.ElementAt(1);

            DirectoryInfo projDir = new DirectoryInfo(Path.GetDirectoryName(ProjectPath));

            while (projDir.Parent != null)
            {
                SolutionPaths = SolutionPaths.Union(Directory.EnumerateFiles(projDir.FullName, "*.sln")).ToArray();

                _bitConfigFilePath = Path.Combine(projDir.FullName, BitConfigFileName);

                if (File.Exists(_bitConfigFilePath))
                {
                    break;
                }

                projDir = projDir.Parent;
            }

            BeingCompiledProjectName = Path.GetFileNameWithoutExtension(ProjectPath);

            InitPropjects();

            await GenerateCodes();
        }
Exemple #2
0
        public static async Task Main(string[] args)
        {
            if (!MSBuildLocator.IsRegistered)
            {
                MSBuildLocator.RegisterInstance(MSBuildLocator.QueryVisualStudioInstances().OrderByDescending(vs => vs.Version).FirstOrDefault() ?? throw new InvalidOperationException("Visual studio could not be found. Please install visual studio build tools."));
            }

            ProjectPath = args.ElementAt(1);

            DirectoryInfo projDir = new DirectoryInfo(Path.GetDirectoryName(ProjectPath));

            while (projDir.Parent != null)
            {
                SolutionPaths = SolutionPaths.Union(Directory.EnumerateFiles(projDir.FullName, "*.sln")).ToArray();

                _bitConfigFilePath = Path.Combine(projDir.FullName, BitConfigFileName);

                if (File.Exists(_bitConfigFilePath))
                {
                    break;
                }

                projDir = projDir.Parent;
            }

            BeingCompiledProjectName = Path.GetFileNameWithoutExtension(ProjectPath);

            InitPropjects();

            await GenerateCodes();
        }
Exemple #3
0
        static void Init(string[] args)
        {
            ProjectPath = args.ElementAt(1);

            DirectoryInfo projDir = new DirectoryInfo(Path.GetDirectoryName(ProjectPath));

            while (projDir.Parent != null)
            {
                SolutionPaths = SolutionPaths.Union(Directory.EnumerateFiles(projDir.FullName, "*.sln")).ToArray();

                _bitConfigFilePath = Path.Combine(projDir.FullName, BitConfigFileName);

                if (File.Exists(_bitConfigFilePath))
                {
                    break;
                }

                projDir = projDir.Parent;
            }

            BeingCompiledProjectName = Path.GetFileNameWithoutExtension(ProjectPath);

            if (string.IsNullOrEmpty(_bitConfigFilePath))
            {
                throw new BitConfigNotFoundException("Could not find bit config");
            }

            foreach (string solutionPath in SolutionPaths)
            {
                AllProjectsPaths = AllProjectsPaths.Union(new Bit.Tooling.CodeGenerator.Implementations.SolutionInfo(solutionPath).GetProjects().Select(p => Path.GetFullPath(p.AbsolutePath))).ToArray();
            }
        }