internal ProjectAnalyzer(AnalyzerManager manager, string projectPath)
        {
            Manager          = manager;
            ProjectPath      = projectPath;
            _projectDocument = GetProjectDocument(projectPath);

            // Get the paths
            _pathHelper = PathHelperFactory.GetPathHelper(projectPath, _projectDocument);

            // Preload/enforce referencing some required asemblies
            Copy copy = new Copy();

            // Set global properties
            _globalProperties = new Dictionary <string, string>
            {
                { MsBuildProperties.SolutionDir, manager.SolutionDirectory ?? Path.GetDirectoryName(projectPath) },
                { MsBuildProperties.MSBuildExtensionsPath, _pathHelper.ExtensionsPath },
                { MsBuildProperties.MSBuildSDKsPath, _pathHelper.SDKsPath },
                { MsBuildProperties.RoslynTargetsPath, _pathHelper.RoslynTargetsPath },
                { MsBuildProperties.DesignTimeBuild, "true" },
                { MsBuildProperties.BuildProjectReferences, "false" },
                { MsBuildProperties.SkipCompilerExecution, "true" },
                { MsBuildProperties.ProvideCommandLineArgs, "true" },
                // Workaround for a problem with resource files, see https://github.com/dotnet/sdk/issues/346#issuecomment-257654120
                { MsBuildProperties.GenerateResourceMSBuildArchitecture, "CurrentArchitecture" }
            };

            // Create the logger
            if (manager.ProjectLogger != null)
            {
                _logger = new ConsoleLogger(manager.LoggerVerbosity, x => LoggerExtensions.LogInformation(manager.ProjectLogger, x), null, null);
            }
        }
Beispiel #2
0
        internal ProjectAnalyzer(AnalyzerManager manager, string projectFilePath, XDocument projectDocument)
        {
            Manager          = manager;
            ProjectFilePath  = projectFilePath;
            _projectDocument = TweakProjectDocument(projectDocument);

            // Get the paths
            _buildEnvironment = EnvironmentFactory.GetBuildEnvironment(projectFilePath, _projectDocument);

            // Preload/enforce referencing some required asemblies
            Copy copy = new Copy();

            // Set global properties
            string solutionDir = manager.SolutionDirectory ?? Path.GetDirectoryName(projectFilePath);

            _globalProperties = _buildEnvironment.GetGlobalProperties(solutionDir);

            // Create the logger
            if (manager.ProjectLogger != null)
            {
                _logger = new ConsoleLogger(manager.LoggerVerbosity, x => LoggerExtensions.LogInformation(manager.ProjectLogger, x), null, null);
            }
        }
Beispiel #3
0
 public void Show()
 {
     LoggerExtensions.LogInformation(this._log, "and again from AcceptsLogViaCtorTypeSafeOldLogger");
 }