public VisualBasicProjectFile(VisualBasicProjectFileLoader loader, MSB.Evaluation.Project loadedProject, IMetadataService metadataService, IAnalyzerService analyzerService) : base(loader, loadedProject)
 {
     this._metadataService             = metadataService;
     this._analyzerService             = analyzerService;
     this._hostBuildDataFactory        = loader.LanguageServices.GetService <IHostBuildDataFactory>();
     this._commandLineArgumentsFactory = loader.LanguageServices.GetService <ICommandLineArgumentsFactoryService>();
 }
 public VisualBasicProjectFile(VisualBasicProjectFileLoader loader, MSB.Evaluation.Project loadedProject, IMetadataService metadataService, IAnalyzerService analyzerService) : base(loader, loadedProject)
 {
     _metadataService = metadataService;
     _analyzerService = analyzerService;
     _hostBuildDataFactory = loader.LanguageServices.GetService<IHostBuildDataFactory>();
     _commandLineArgumentsFactory = loader.LanguageServices.GetService<ICommandLineArgumentsFactoryService>();
 }
Ejemplo n.º 3
0
 public VisualBasicProjectFile(
     VisualBasicProjectFileLoader loader,
     MSB.Evaluation.Project?loadedProject,
     ProjectBuildManager buildManager,
     DiagnosticLog log
     ) : base(loader, loadedProject, buildManager, log)
 {
 }
Ejemplo n.º 4
0
            private ProjectFileInfo CreateProjectFileInfo(VisualBasicProjectFileLoader.VisualBasicProjectFile.VisualBasicCompilerInputs compilerInputs, ProjectInstance executedProject)
            {
                string outputPath = Path.Combine(this.GetOutputDirectory(), compilerInputs.OutputFileName);
                string assemblyName = this.GetAssemblyName();

                return new ProjectFileInfo(
                    outputPath,
                    assemblyName,
                    compilerInputs.CommandLineArgs,
                    this.GetDocuments(compilerInputs.Sources, executedProject),
                    this.GetDocuments(compilerInputs.AdditionalFiles, executedProject),
                    base.GetProjectReferences(executedProject));
            }
            private ProjectFileInfo CreateProjectFileInfo(VisualBasicProjectFileLoader.VisualBasicProjectFile.VisualBasicCompilerInputs compilerInputs, BuildInfo buildInfo)
            {
                string outputPath = Path.Combine(this.GetOutputDirectory(), compilerInputs.OutputFileName);
                string assemblyName = this.GetAssemblyName();
                var documents = buildInfo.Project != null ? this.GetDocuments(compilerInputs.Sources, buildInfo.Project) : SpecializedCollections.EmptyEnumerable<DocumentFileInfo>();
                var additionalDocuments = buildInfo.Project != null ? this.GetDocuments(compilerInputs.AdditionalFiles, buildInfo.Project) : SpecializedCollections.EmptyEnumerable<DocumentFileInfo>();
                var projectRefeferences = buildInfo.Project != null ? base.GetProjectReferences(buildInfo.Project) : SpecializedCollections.EmptyEnumerable<ProjectFileReference>();

                return new ProjectFileInfo(
                    outputPath,
                    assemblyName,
                    compilerInputs.CommandLineArgs,
                    documents,
                    additionalDocuments,
                    projectRefeferences,
                    buildInfo.ErrorMessage);
            }
Ejemplo n.º 6
0
 public VisualBasicProjectFile(VisualBasicProjectFileLoader loader, MSB.Evaluation.Project loadedProject, string errorMessage)
     : base(loader, loadedProject, errorMessage)
 {
 }
Ejemplo n.º 7
0
 public VisualBasicProjectFile(VisualBasicProjectFileLoader loader, MSB.Evaluation.Project loadedProject) : base(loader, loadedProject)
 {
 }
Ejemplo n.º 8
0
            private void InitializeFromModel(VisualBasicProjectFileLoader.VisualBasicProjectFile.VisualBasicCompilerInputs compilerInputs, ProjectInstance executedProject)
            {
                compilerInputs.BeginInitialization();
                compilerInputs.SetBaseAddress(base.ReadPropertyString(executedProject, "OutputType"), base.ReadPropertyString(executedProject, "BaseAddress"));
                compilerInputs.SetCodePage(base.ReadPropertyInt(executedProject, "CodePage"));
                compilerInputs.SetDebugType(base.ReadPropertyBool(executedProject, "DebugSymbols"), base.ReadPropertyString(executedProject, "DebugType"));
                compilerInputs.SetDefineConstants(base.ReadPropertyString(executedProject, "FinalDefineConstants", "DefineConstants"));
                compilerInputs.SetFeatures(base.ReadPropertyString(executedProject, "Features"));
                compilerInputs.SetDelaySign(base.ReadPropertyBool(executedProject, "DelaySign"));
                compilerInputs.SetDisabledWarnings(base.ReadPropertyString(executedProject, "NoWarn"));
                compilerInputs.SetDocumentationFile(base.GetItemString(executedProject, "DocFileItem"));
                compilerInputs.SetErrorReport(base.ReadPropertyString(executedProject, "ErrorReport"));
                compilerInputs.SetFileAlignment(base.ReadPropertyInt(executedProject, "FileAlignment"));
                compilerInputs.SetGenerateDocumentation(base.ReadPropertyBool(executedProject, "GenerateDocumentation"));
                compilerInputs.SetHighEntropyVA(base.ReadPropertyBool(executedProject, "HighEntropyVA"));
                compilerInputs.SetFeatures(base.ReadPropertyString(executedProject, "Features"));

                var _imports = this.GetTaskItems(executedProject, "Import");
                if (_imports != null)
                {
                    compilerInputs.SetImports(_imports.ToArray());
                }

                var signAssembly = ReadPropertyBool(executedProject, "SignAssembly");
                if (signAssembly)
                {
                    var keyFile = ReadPropertyString(executedProject, "KeyOriginatorFile", "AssemblyOriginatorKeyFile");
                    if (!string.IsNullOrEmpty(keyFile))
                    {
                        compilerInputs.SetKeyFile(keyFile);
                    }

                    var keyContainer = ReadPropertyString(executedProject, "KeyContainerName");
                    if (!string.IsNullOrEmpty(keyContainer))
                    {
                        compilerInputs.SetKeyContainer(keyContainer);
                    }
                }

                compilerInputs.SetLanguageVersion(base.ReadPropertyString(executedProject, "LangVersion"));
                compilerInputs.SetMainEntryPoint(base.ReadPropertyString(executedProject, "StartupObject"));
                compilerInputs.SetModuleAssemblyName(base.ReadPropertyString(executedProject, "ModuleEntryPoint"));
                compilerInputs.SetNoStandardLib(base.ReadPropertyBool(executedProject, "NoCompilerStandardLib", "NoStdLib"));
                compilerInputs.SetNoWarnings(base.ReadPropertyBool(executedProject, "_NoWarnings"));
                compilerInputs.SetOptimize(base.ReadPropertyBool(executedProject, "Optimize"));
                compilerInputs.SetOptionCompare(base.ReadPropertyString(executedProject, "OptionCompare"));
                compilerInputs.SetOptionExplicit(base.ReadPropertyBool(executedProject, "OptionExplicit"));
                compilerInputs.SetOptionInfer(base.ReadPropertyBool(executedProject, "OptionInfer"));
                compilerInputs.SetOptionStrictType(base.ReadPropertyString(executedProject, "OptionStrict"));
                compilerInputs.SetOutputAssembly(base.GetItemString(executedProject, "IntermediateAssembly"));

                if (base.ReadPropertyBool(executedProject, "Prefer32Bit"))
                {
                    compilerInputs.SetPlatformWith32BitPreference(base.ReadPropertyString(executedProject, "PlatformTarget"));
                }
                else
                {
                    compilerInputs.SetPlatform(base.ReadPropertyString(executedProject, "PlatformTarget"));
                }

                compilerInputs.SetRemoveIntegerChecks(base.ReadPropertyBool(executedProject, "RemoveIntegerChecks"));
                compilerInputs.SetRootNamespace(base.ReadPropertyString(executedProject, "RootNamespace"));
                compilerInputs.SetSdkPath(base.ReadPropertyString(executedProject, "FrameworkPathOverride"));
                compilerInputs.SetSubsystemVersion(base.ReadPropertyString(executedProject, "SubsystemVersion"));
                compilerInputs.SetTargetCompactFramework(base.ReadPropertyBool(executedProject, "TargetCompactFramework"));
                compilerInputs.SetTargetType(base.ReadPropertyString(executedProject, "OutputType"));

                // Decode the warning options from RuleSet file prior to reading explicit settings in the project file, so that project file settings prevail for duplicates.
                compilerInputs.SetRuleSet(base.ReadPropertyString(executedProject, "RuleSet"));

                compilerInputs.SetTreatWarningsAsErrors(base.ReadPropertyBool(executedProject, "SetTreatWarningsAsErrors"));
                compilerInputs.SetVBRuntime(base.ReadPropertyString(executedProject, "VbRuntime"));
                compilerInputs.SetWarningsAsErrors(base.ReadPropertyString(executedProject, "WarningsAsErrors"));
                compilerInputs.SetWarningsNotAsErrors(base.ReadPropertyString(executedProject, "WarningsNotAsErrors"));
                compilerInputs.SetReferences(this.GetMetadataReferencesFromModel(executedProject).ToArray<ITaskItem>());
                compilerInputs.SetAnalyzers(this.GetAnalyzerReferencesFromModel(executedProject).ToArray<ITaskItem>());
                compilerInputs.SetAdditionalFiles(this.GetAdditionalFilesFromModel(executedProject).ToArray<ITaskItem>());
                compilerInputs.SetSources(this.GetDocumentsFromModel(executedProject).ToArray<ITaskItem>());
                compilerInputs.EndInitialization();
            }
 public VisualBasicProjectFile(VisualBasicProjectFileLoader loader, MSB.Evaluation.Project loadedProject) : base(loader, loadedProject)
 {
 }
            private void GetReferences(VisualBasicProjectFileLoader.VisualBasicProjectFile.VisualBasicCompilerInputs compilerInputs, ProjectInstance executedProject, ref IEnumerable<MetadataReference> metadataReferences, ref IEnumerable<AnalyzerReference> analyzerReferences)
            {
                // use command line parser to compute references using common logic
                List<string> list = new List<string>();
                if (compilerInputs.LibPaths != null && compilerInputs.LibPaths.Count<string>() > 0)
                {
                    list.Add("/libpath:\"" + string.Join(";", compilerInputs.LibPaths) + "\"");
                }

                // metadata references
                foreach (var current in compilerInputs.References)
                {
                    if (!IsProjectReferenceOutputAssembly(current))
                    {
                        string documentFilePath = base.GetDocumentFilePath(current);
                        list.Add("/r:\"" + documentFilePath + "\"");
                    }
                }

                // analyzer references
                foreach (var current in compilerInputs.AnalyzerReferences)
                {
                    string documentFilePath2 = base.GetDocumentFilePath(current);
                    list.Add("/a:\"" + documentFilePath2 + "\"");
                }

                if (compilerInputs.NoStandardLib)
                {
                    list.Add("/nostdlib");
                }

                if (!string.IsNullOrEmpty(compilerInputs.VbRuntime))
                {
                    if (compilerInputs.VbRuntime == "Default")
                    {
                        list.Add("/vbruntime+");
                    }
                    else if (compilerInputs.VbRuntime == "Embed")
                    {
                        list.Add("/vbruntime*");
                    }
                    else if (compilerInputs.VbRuntime == "None")
                    {
                        list.Add("/vbruntime-");
                    }
                    else
                    {
                        list.Add("/vbruntime: " + compilerInputs.VbRuntime);
                    }
                }

                if (!string.IsNullOrEmpty(compilerInputs.SdkPath))
                {
                    list.Add("/sdkpath:" + compilerInputs.SdkPath);
                }

                CommandLineArguments commandLineArguments = _commandLineArgumentsFactory.CreateCommandLineArguments(list, executedProject.Directory, false, RuntimeEnvironment.GetRuntimeDirectory());
                MetadataFileReferenceResolver pathResolver = new MetadataFileReferenceResolver(commandLineArguments.ReferencePaths, commandLineArguments.BaseDirectory);
                metadataReferences = commandLineArguments.ResolveMetadataReferences(new AssemblyReferenceResolver(pathResolver, _metadataService.GetProvider()));

                IAnalyzerAssemblyLoader loader = _analyzerService.GetLoader();
                foreach (var path in commandLineArguments.AnalyzerReferences.Select((r) => r.FilePath))
                {
                    loader.AddDependencyLocation(path);
                }

                analyzerReferences = commandLineArguments.ResolveAnalyzerReferences(loader);
            }
 private ProjectFileInfo CreateProjectFileInfo(VisualBasicProjectFileLoader.VisualBasicProjectFile.VisualBasicCompilerInputs compilerInputs, ProjectInstance executedProject)
 {
     IEnumerable<MetadataReference> metadataReferences = null;
     IEnumerable<AnalyzerReference> analyzerReferences = null;
     this.GetReferences(compilerInputs, executedProject, ref metadataReferences, ref analyzerReferences);
     string outputPath = Path.Combine(this.GetOutputDirectory(), compilerInputs.OutputFileName);
     string assemblyName = this.GetAssemblyName();
     HostBuildData hostBuildData = _hostBuildDataFactory.Create(compilerInputs.HostBuildOptions);
     return new ProjectFileInfo(outputPath, assemblyName, hostBuildData.CompilationOptions, hostBuildData.ParseOptions, compilerInputs.CodePage, this.GetDocuments(compilerInputs.Sources, executedProject), this.GetDocuments(compilerInputs.AdditionalFiles, executedProject), base.GetProjectReferences(executedProject), metadataReferences, analyzerReferences);
 }
 public VisualBasicProjectFile(VisualBasicProjectFileLoader loader, MSB.Evaluation.Project loadedProject, string errorMessage) 
     : base(loader, loadedProject, errorMessage)
 {
 }