public ProjectConfiguration GetProjectConfiguration()
        {
            ProjectConfiguration projectConfiguration = new ProjectConfiguration
            {
                Properties = new PropertyConfigurationCollection
                {
                    new PropertyConfiguration("LoggingBackend", "trace") { Overwrite = false },
                },
                TaskTypes = new TaskTypeConfigurationCollection
                {
                    new TaskTypeConfiguration(InstrumentationPlugIn.Name, project => new InstrumentationPlugIn())
                    {
                        AutoInclude = true,
                        Dependencies = new DependencyConfigurationCollection
                        {
                            new DependencyConfiguration("AspectWeaver")
                        }
                    }
                },
                Services = new ServiceConfigurationCollection
                {
                    new ServiceConfiguration(project => new DiagnosticsBackendProvider()),
                },
                TaskFactories = new Dictionary<string, CreateTaskDelegate>
                {
                    { InstrumentationPlugIn.Name, project => new InstrumentationPlugIn() }
                }
            };

            return projectConfiguration;
        }
Example #2
0
 public AddPackageCommand(string name, string version, NugsDirectory nugsDirectory, ProjectConfiguration projectConfiguration, FileSystem fileSystem)
 {
     _name = name;
     _version = version;
     _nugsDirectory = nugsDirectory;
     _projectConfiguration = projectConfiguration;
     _fileSystem = fileSystem;
 }
 public ProjectConfiguration InferProjectConfiguration()
 {
   ProjectConfiguration configuration = new ProjectConfiguration();
   configuration.Name = _root.Name;
   configuration.Root = FindRootDirectory();
   configuration.Build = FindBuildDirectory();
   configuration.Library = FindLibraryDirectory();
   configuration.EnsureValid();
   return configuration;
 }
        public ProjectConfiguration GetProjectConfiguration()
        {
            ProjectConfiguration projectConfiguration = new ProjectConfiguration
            {
                Services = new ServiceConfigurationCollection
                {
                    new ServiceConfiguration(project => new NLogBackendProvider())
                },
            };

            return projectConfiguration;
        }
Example #5
0
        static void Main(string[] args)
        {
            var config = new ProjectConfiguration(
                new Guid("5501698e-6c0f-4386-8ad3-6691a439fea0"),
                new Guid("08EC8F28-4E0A-4FDC-BAE6-05BE7BA59833"),
                "Apollo.Sports.Core",
                "Sports.Core",
                "Sports.Core",
                false,
                true,
                false
            );

            WebApiHostRunner.RunMain(config);
        }
        public void GetProjectConfiguration_SingleProviderReturnsFalse_ReturnsNull()
        {
            // Arrange
            var projectInstance = new ProjectInstance(ProjectRootElement.Create());
            projectInstance.AddItem(MSBuildProjectManager.ProjectCapabilityItemType, CoreProjectConfigurationProvider.DotNetCoreRazorCapability);
            var provider = new Mock<ProjectConfigurationProvider>();
            var configuration = new ProjectConfiguration(RazorConfiguration.Default, Array.Empty<OmniSharpHostDocument>(), "TestRootNamespace"); // Setting to non-null to ensure the listener doesn't return the config verbatim.
            provider.Setup(p => p.TryResolveConfiguration(It.IsAny<ProjectConfigurationProviderContext>(), out configuration))
                .Returns(false);

            // Act
            var result = MSBuildProjectManager.GetProjectConfiguration(projectInstance, Enumerable.Empty<ProjectConfigurationProvider>());

            // Assert
            Assert.Null(result);
        }
Example #7
0
        private static void ConfigureDynamics(IServiceCollection services, ProjectConfiguration project, ProjectResource projectResource, Serilog.ILogger logger)
        {
            Debug.Assert(services != null, "Required ServiceCollection is null");
            Debug.Assert(project != null, "Required ProjectConfiguration is null");
            Debug.Assert(projectResource != null, "Required ProjectResource is null");
            Debug.Assert(projectResource.Type == ProjectType.Dynamics, "Project type must be Dynamics");

            // the projectResourceKey convention is repeated also in OAuthClientFactory which gets the HttpClient using the same convention,
            //
            // {Id}-dynamics-authorization
            //
            string projectResourceKey = project.Id + "-dynamics";

            // add authorization HttpClient
            services.AddHttpClient(projectResourceKey + "-authorization", configure => configure.BaseAddress = projectResource.AuthorizationUri)
            ;

            // add odata HttpClient
            // note: I do not like this IoC anti-pattern where we are using the service locator directly, however,
            //       there are many named dependencies. There may be an opportunity to address this in the future

            var builder = services.AddHttpClient(projectResourceKey, configure =>
            {
                configure.BaseAddress = projectResource.Resource;
            })
                          .AddHttpMessageHandler(serviceProvider =>
            {
                // build the token service that talk to the OAuth endpoint
                IOAuthClientFactory oauthClientFactory = serviceProvider.GetRequiredService <IOAuthClientFactory>();
                IOAuthClient client = oauthClientFactory.Create(project);
                ITokenCache <OAuthOptions, Token> tokenCache = serviceProvider.GetRequiredService <ITokenCache <OAuthOptions, Token> >();

                ITokenService tokenService = new OAuthTokenService(client, tokenCache);
                var handler = new TokenAuthorizationHandler(tokenService, CreateOAuthOptions(projectResource));
                return(handler);
            });

            var apiGatewayHost   = projectResource.ApiGatewayHost;
            var apiGatewayPolicy = projectResource.ApiGatewayPolicy;

            if (!string.IsNullOrEmpty(apiGatewayHost) && !string.IsNullOrEmpty(apiGatewayPolicy))
            {
                // add the ApiGatewayHandler
                logger.Information("Using {@ApiGateway} for {Resource}", new { Host = apiGatewayHost, Policy = apiGatewayPolicy }, projectResource.Resource);
                builder.AddHttpMessageHandler(() => new ApiGatewayHandler(apiGatewayHost, apiGatewayPolicy));
            }
        }
Example #8
0
            public SolutionNode AddChild(
                Guid projectGuid,
                Project project,
                ProjectConfiguration configuration,
                string relativePath)
            {
                var child = new SolutionNode(
                    Top,
                    this,
                    projectGuid,
                    project,
                    configuration,
                    relativePath);

                children.Add(child);
                return(child);
            }
Example #9
0
        /// <summary>
        /// Initializes a new instance of ProjectRewriter using an existing analysis
        /// </summary>
        /// <param name="analyzerResult">The analysis results of the project</param>
        /// <param name="rulesEngineConfiguration">ProjectConfiguration for this project</param>
        public ProjectRewriter(AnalyzerResult analyzerResult, ProjectConfiguration rulesEngineConfiguration)
        {
            _projectResult = new ProjectResult()
            {
                ProjectFile     = rulesEngineConfiguration.ProjectPath,
                TargetVersions  = rulesEngineConfiguration.TargetVersions,
                UpgradePackages = rulesEngineConfiguration.PackageReferences.Select(p => new PackageAction()
                {
                    Name = p.Key, Version = p.Value
                }).ToList()
            };

            _sourceFileBuildResults  = analyzerResult?.ProjectBuildResult?.SourceFileBuildResults;
            _sourceFileResults       = analyzerResult?.ProjectResult?.SourceFileResults;
            _projectReferences       = analyzerResult?.ProjectBuildResult?.ExternalReferences?.ProjectReferences.Select(p => p.AssemblyLocation).ToList();
            RulesEngineConfiguration = rulesEngineConfiguration;
        }
Example #10
0
        private void ReadProject(string fileName)
        {
            var config = new ProjectConfiguration();

            // user chose a file
            CurrentProjectFile = fileName;

            // open the ProjectConfiguration
            var projectConfiguration = DiskStorage.LoadFromDisk <ProjectConfiguration>(fileName);

            if (projectConfiguration != null)
            {
                Project = new Project(projectConfiguration);

                UpdateUserInterface();
            }
        }
        protected ResourceUserManagementService(ProjectConfiguration project, ProjectResource projectResource, ILogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            Project         = project ?? throw new ArgumentNullException(nameof(project));
            ProjectResource = projectResource ?? throw new ArgumentNullException(nameof(projectResource));

            if (project.Resources.All(_ => _ != projectResource))
            {
                throw new ArgumentException("Project resource is not from the project", nameof(projectResource));
            }

            Logger = logger
                     .ForContext("Project", Destructure(project, projectResource), true);
        }
        /// <summary>
        /// Retrieves the <see cref="IRule"/> with name "<paramref name="schemaName"/>" within the given <paramref
        /// name="projectConfiguration"/> and <paramref name="propertiesContext"/>.
        /// </summary>
        public async Task <IRule?> BindToRuleAsync(ProjectConfiguration projectConfiguration, string schemaName, QueryProjectPropertiesContext propertiesContext)
        {
            if (_ruleCache.TryGetValue((projectConfiguration, schemaName, propertiesContext), out IRule? cachedRule))
            {
                return(cachedRule);
            }

            IRule?rule = null;

            if (await GetProjectLevelPropertyPagesCatalogAsync(projectConfiguration) is IPropertyPagesCatalog catalog)
            {
                rule = catalog.BindToContext(schemaName, propertiesContext);
            }

            _ruleCache.Add((projectConfiguration, schemaName, propertiesContext), rule);
            return(rule);
        }
Example #13
0
        public async Task ProjectLoadedAsync_AddsNewProjectWithDocument()
        {
            // Arrange
            var projectRootElement     = ProjectRootElement.Create("/project/project.csproj");
            var intermediateOutputPath = "/project/obj";

            projectRootElement.AddProperty(MSBuildProjectManager.IntermediateOutputPathPropertyName, intermediateOutputPath);
            var projectInstance       = new ProjectInstance(projectRootElement);
            var hostDocument          = new OmniSharpHostDocument("file.razor", "file.razor", FileKinds.Component);
            var projectConfiguration  = new ProjectConfiguration(CustomConfiguration, new[] { hostDocument }, "TestRootNamespace");
            var configurationProvider = new Mock <ProjectConfigurationProvider>(MockBehavior.Strict);

            configurationProvider.Setup(provider => provider.TryResolveConfiguration(It.IsAny <ProjectConfigurationProviderContext>(), out projectConfiguration))
            .Returns(true);
            var projectChangePublisher = new Mock <ProjectChangePublisher>(MockBehavior.Strict);

            projectChangePublisher.Setup(p => p.SetPublishFilePath(It.IsAny <string>(), It.IsAny <string>())).Verifiable();
            var msbuildProjectManager = new MSBuildProjectManager(
                new[] { configurationProvider.Object },
                CreateProjectInstanceEvaluator(),
                projectChangePublisher.Object,
                Dispatcher,
                LoggerFactory);
            var projectManager = CreateProjectSnapshotManager();

            msbuildProjectManager.Initialize(projectManager);
            var args = new ProjectLoadedEventArgs(
                ProjectId.CreateNewId(),
                projectInstance,
                diagnostics: Enumerable.Empty <MSBuildDiagnostic>().ToImmutableArray(),
                isReload: false,
                projectIdIsDefinedInSolution: false,
                sourceFiles: Enumerable.Empty <string>().ToImmutableArray());

            // Act
            await msbuildProjectManager.ProjectLoadedAsync(args);

            // Assert
            var project = await RunOnForegroundAsync(() => Assert.Single(projectManager.Projects));

            Assert.Equal(projectInstance.ProjectFileLocation.File, project.FilePath);
            Assert.Same(CustomConfiguration, project.Configuration);
            var document = project.GetDocument(hostDocument.FilePath);

            Assert.NotNull(document);
        }
Example #14
0
        private ProjectConfiguration _FindConfigByName(string projectName)
        {
            Debug.Assert(projectName != null);

            ProjectConfiguration projectConfig = null;

            foreach (ProjectConfiguration config in _Application.ProjectCatalog.Projects)
            {
                if (config.Name.Equals(projectName, StringComparison.InvariantCultureIgnoreCase))
                {
                    projectConfig = config;
                    break;
                }
            }

            return(projectConfig);
        }
Example #15
0
        public ProjectRewriter(IDEProjectResult projectResult, ProjectConfiguration rulesEngineConfiguration)
        {
            _sourceFileResults       = projectResult.RootNodes;
            _sourceFileBuildResults  = projectResult.SourceFileBuildResults;
            RulesEngineConfiguration = rulesEngineConfiguration;

            _projectResult = new ProjectResult()
            {
                ProjectFile     = rulesEngineConfiguration.ProjectPath,
                TargetVersions  = rulesEngineConfiguration.TargetVersions,
                UpgradePackages = rulesEngineConfiguration.PackageReferences.Select(p => new PackageAction()
                {
                    Name            = p.Key,
                    OriginalVersion = p.Value.Item1,
                    Version         = p.Value.Item2
                }).ToList()
            };
        }
Example #16
0
        private void dgv_projectConfigurations_SelectionChanged(object sender, EventArgs e)
        {
            ClearProjectConfigurationBuildsList();

            if (dgv_projectConfigurations.SelectedRows.Count == 0)
            {
                ToggleProjectConfigurationContextButtonsEnabled(false);
                return;
            }

            ToggleProjectConfigurationContextButtonsEnabled(true);

            var    projectConfigurationInListViewModel = (ProjectConfigurationInListViewModel)dgv_projectConfigurations.SelectedRows[0].DataBoundItem;
            string projectName = projectConfigurationInListViewModel.ProjectName;
            ProjectConfiguration projectConfiguration = projectConfigurationInListViewModel.ProjectConfiguration;

            LoadProjectConfigurationBuilds(projectName, projectConfiguration);
        }
        private static bool IsActiveConfigurationCandidate(ProjectConfiguration activeSolutionConfiguration, ProjectConfiguration configuration, IImmutableSet <string> ignoredDimensionNames)
        {
            foreach ((string dimensionName, string dimensionValue) in activeSolutionConfiguration.Dimensions)
            {
                if (ignoredDimensionNames.Contains(dimensionName))
                {
                    continue;
                }

                if (!configuration.Dimensions.TryGetValue(dimensionName, out string otherDimensionValue) ||
                    !string.Equals(dimensionValue, otherDimensionValue, StringComparison.Ordinal))
                {
                    return(false);
                }
            }

            return(true);
        }
        void GenerateFile(ProjectConfiguration project, TableImportArgumentsViewModel table, TypeCodeGenerator generator, string filename)
        {
            var file = !string.IsNullOrEmpty(project.GeneratedCodeFolder) ? Path.Combine(project.ProjectFolder, project.GeneratedCodeFolder, $"{filename}.cs") : Path.Combine(project.ProjectFolder, $"{filename}.cs");

            if (!File.Exists(file))
            {
                using (var stream = File.Create(file))
                {
                    generator.Generate(_solution, project, table, stream);
                }
                _solution.AddExistedFileToProject(project.ProjectPath, file);
            }
            else
            {
                var data = generator.Generate(_solution, project, table);
                File.WriteAllBytes(file, data);
            }
        }
Example #19
0
        /// <summary>
        /// Creates or retrieves an Azure NetApp Files Account
        /// </summary>
        /// <param name="config">Project Configuration file which contains the resource group needed</param>
        /// <param name="client">Azure NetApp Files Management Client</param>
        /// <param name="account">ModelNetAppAccount object that contains the data configured in the appsettings.json file for the ANF account</param>
        /// <returns>NetAppCount object</returns>
        private static async Task <NetAppAccount> CreateOrRetrieveAccountAsync(ProjectConfiguration config, AzureNetAppFilesManagementClient client, ModelNetAppAccount account)
        {
            // Creating ANF Account
            NetAppAccount anfAccount = await GetResourceAsync <NetAppAccount>(client, config.ResourceGroup, account.Name);

            if (anfAccount == null)
            {
                anfAccount = await CreateOrUpdateAnfAccountAsync(config, client, account);

                Utils.WriteConsoleMessage($"\tAccount successfully created, resource id: {anfAccount.Id}");
            }
            else
            {
                Utils.WriteConsoleMessage($"\tAccount already exists, resource id: {anfAccount.Id}");
            }

            return(anfAccount);
        }
        public override DeployFileCollection GetProjectDeployFiles(DeployContext ctx, Project project, ConfigurationSelector configuration)
        {
            DeployFileCollection deployFiles = new DeployFileCollection();

            base.GetProjectDeployFiles(ctx, project, configuration);

            // Add the compiled output files

            ProjectConfiguration pconf  = (ProjectConfiguration)project.GetConfiguration(configuration);
            FilePath             outDir = pconf.OutputDirectory;

            foreach (FilePath file in project.GetOutputFiles(configuration))
            {
                deployFiles.Add(new DeployFile(project, file, file.ToRelative(outDir), TargetDirectory.ProgramFiles));
            }

//			FilePath outputFile = project.GetOutputFileName (configuration);

            // Collect deployable files
            foreach (ProjectFile file in project.Files)
            {
                // skip CopyToOutputDirectory files when it's just a project build, because
                // MonoDevelop.Project.Projects already copies these files using more subtle overwriting
                // semantics
                if (file.CopyToOutputDirectory != FileCopyMode.None)
                {
                    continue;
                }

                DeployProperties props = new DeployProperties(file);
                if (props.ShouldDeploy)
                {
                    DeployFile dp = new DeployFile(file);
                    deployFiles.Add(dp);
                }
            }

            foreach (FileCopySet.Item item in project.GetSupportFileList(configuration))
            {
                deployFiles.Add(new DeployFile(project, item.Src, item.Target, TargetDirectory.ProgramFiles));
            }

            return(deployFiles);
        }
Example #21
0
        public void Execute()
        {
            var             configuration = new ProjectConfiguration();
            ProjectSettings settings      = configuration.GetProjectSettings();

            string sourceContent = File.ReadAllText(Path.Join(settings.RootDirectory, ProjectStructureConstants.ChangelogFileName));

            var repository = new ChangeLogEntryRepository(settings);
            IEnumerable <ChangeLogEntry> entries = repository.GetChangelogEntries();

            var changelogContent = new ChangeLogBuilder(settings)
                                   .WithContent(sourceContent)
                                   .WithEntries(entries)
                                   .Build();

            File.WriteAllText(Path.Join(settings.RootDirectory, ProjectStructureConstants.ChangelogFileName), changelogContent);

            repository.DeleteChangelogEntries();
        }
Example #22
0
        /// <summary>Creates an <see cref="IOAuthClient" /> for the given project.</summary>
        /// <param name="project">The project.</param>
        /// <returns></returns>
        /// <remarks>This only works with Dynamics resources due to hard coded HttpClientFactory factory names.</remarks>
        public IOAuthClient Create(ProjectConfiguration project)
        {
            if (project == null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            // OAuth is always dynamics
            string projectResourceKey = project.Id + "-dynamics";

            var        httpClientFactory = _serviceProvider.GetRequiredService <IHttpClientFactory>();
            HttpClient httpClient        = httpClientFactory.CreateClient(projectResourceKey + "-authorization");

            // create the handler that will authenticate the call and add authorization header
            ILogger <OAuthClient> clientLogger = _serviceProvider.GetRequiredService <ILogger <OAuthClient> >();
            var oauthClient = new OAuthClient(httpClient, clientLogger);

            return(oauthClient);
        }
Example #23
0
        public VSProject(VSSolution solution, string filepath, string name) : base(null, null, filepath)
        {
            Solution = solution;

            string configPath = Path.Combine(Path.Combine(Solution.SolutionDirectory.FullName, CleanDirectoryPath(filepath)), Path.GetFileNameWithoutExtension(filepath) + ResxClientConfigurationBase.RESXCLIENTPROJECTFILE_EXTENSION);

            ResxProjectFile = new ProjectConfiguration(configPath);

            FilePath  = filepath;
            Name      = name;
            ShortName = solution.generateProjectShortName(name);
            Type      = resolveProjectType(filepath);

            base.Init(CleanDirectoryPath(filepath));

            string tfsFile = Path.Combine(Solution.SolutionDirectory.FullName, filepath + VSS_PROJECT_METAFILE_EXTENSION);

            UnderTfsControl = File.Exists(tfsFile);
        }
 public AssetStoreViewModel(IAssetStore store, IConfigurationContainer <ProjectConfiguration> configuration,
                            ProjectReference project)
 {
     _store         = store;
     _configuration = configuration.Value;
     _project       = project;
     _searchTextObservable.StartWith(_searchText)
     .CombineLatest(_includePrereleaseObservable.StartWith(_includePrerelease),
                    (t, p) => new AssetStoreQueryArgs {
         Text = t, IncludePrerelease = p
     })
     .Throttle(TimeSpan.FromSeconds(1))
     .Select(_ => _store.Query(_).ToObservable())
     .Switch()
     .ObserveOnDispatcher()
     .Subscribe(OnSearchResult);
     ClosePackageCommand   = new ActionCommand(ClosePackage);
     InstallPackageCommand = new AsyncCommand(InstallPackage);
 }
Example #25
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.BuildServiceProvider();
            var projectConfiguration = new ProjectConfiguration();

            new ConfigureFromConfigurationOptions <ProjectConfiguration>(Configuration.GetSection("ProjectConfiguration")).Configure(projectConfiguration);

            services.AddSingleton(projectConfiguration);
            services.AddScoped <ILiveWeatherService, LiveWeatherService>();
            services.AddScoped <IMessages, Messages>();
            services.AddMvcCore().AddJsonFormatters().AddApiExplorer();
            services.AddSwaggerGen(c =>
            {
                c.OperationFilter <SetBodyParameters>();
                c.SwaggerDoc("v1",
                             new Info
                {
                    Title       = "LiveWeatherApi",
                    Version     = "v1",
                    Description = "Live weather forecast."
                });

                string caminhoAplicacao =
                    PlatformServices.Default.Application.ApplicationBasePath;
                string nomeAplicacao =
                    PlatformServices.Default.Application.ApplicationName;
                string caminhoXmlDoc =
                    Path.Combine(caminhoAplicacao, $"{nomeAplicacao}.xml");

                c.IncludeXmlComments(caminhoXmlDoc);
            });

            // Configura��o do CORS
            services.AddCors(o => o.AddPolicy("CorsConfig", builder =>
            {
                builder.AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader();
            }));

            AdapterDtoDomain.MapperRegister();
        }
Example #26
0
        void btnOk_Click(object sender, RoutedEventArgs e)
        {
            if (!Check())
            {
                return;
            }

            int value = 0;

            // сколько дней перечитывать
            if (int.TryParse(txtReadDays.Text, out value))
            {
                ProjectConfiguration.LoadDays = value;
            }
            // как часто перечитывать
            if (int.TryParse(txtUpdateTimeSec.Text, out value))
            {
                ProjectConfiguration.UpdateTimeSec = value;
            }
            //через сколько мин закрывать окно оповещения
            if (int.TryParse(txtAlertShowTimeMin.Text, out value))
            {
                ProjectConfiguration.AlertShowTimeMin = value;
            }

            // адпрес сервера
            if (ProjectConfiguration.Address != txtAddress.Text)
            {
                ProjectConfiguration.Address = txtAddress.Text;

                ServiceManager.CloseClient();
                ProjectManager.ReloadProjectsAsync();
            }

            // панель оповещений
            ProjectConfiguration.IsShowMessageMenu = cmbIsShowMessageMenu.IsChecked == true;
            ProjectConfiguration.IsHideAlertWin    = chkIsHideAlertWin.IsChecked == true;
            ProjectConfiguration.IsEnableColorsOnMainImportToExcel = cmbIsEnableColorsOnMainImportToExcel.IsChecked == true;

            ProjectConfiguration.Save();
            Close();
        }
        /// <summary>
        ///     Creates a <see cref="AggregateCrossTargetProjectContext"/>.
        /// </summary>
        /// <returns>
        ///     The created <see cref="AggregateCrossTargetProjectContext"/>.
        /// </returns>
        public async Task <AggregateCrossTargetProjectContext> CreateProjectContextAsync()
        {
            // Get the set of active configured projects ignoring target framework.
#pragma warning disable CS0618 // Type or member is obsolete
            ImmutableDictionary <string, ConfiguredProject>?configuredProjectsMap = await _activeConfiguredProjectsProvider.GetActiveConfiguredProjectsMapAsync();

#pragma warning restore CS0618 // Type or member is obsolete

            if (configuredProjectsMap == null)
            {
                throw new InvalidOperationException("There are no active configured projects.");
            }

            ProjectConfiguration activeProjectConfiguration             = _commonServices.ActiveConfiguredProject.ProjectConfiguration;
            ImmutableArray <ITargetFramework> .Builder targetFrameworks = ImmutableArray.CreateBuilder <ITargetFramework>(initialCapacity: configuredProjectsMap.Count);
            ITargetFramework activeTargetFramework = TargetFramework.Empty;

            foreach ((string tfm, ConfiguredProject configuredProject) in configuredProjectsMap)
            {
                ProjectProperties    projectProperties = configuredProject.Services.ExportProvider.GetExportedValue <ProjectProperties>();
                ConfigurationGeneral configurationGeneralProperties = await projectProperties.GetConfigurationGeneralPropertiesAsync();

                ITargetFramework targetFramework = await GetTargetFrameworkAsync(tfm, configurationGeneralProperties);

                targetFrameworks.Add(targetFramework);

                if (activeTargetFramework.Equals(TargetFramework.Empty) &&
                    configuredProject.ProjectConfiguration.Equals(activeProjectConfiguration))
                {
                    activeTargetFramework = targetFramework;
                }
            }

            bool isCrossTargeting = !(configuredProjectsMap.Count == 1 && string.IsNullOrEmpty(configuredProjectsMap.First().Key));

            return(new AggregateCrossTargetProjectContext(
                       isCrossTargeting,
                       targetFrameworks.MoveToImmutable(),
                       configuredProjectsMap,
                       activeTargetFramework,
                       _targetFrameworkProvider));
        }
Example #28
0
        private void ProjectImportDialog_Load(object sender, EventArgs e)
        {
            Text    = String.Format(Text, Program.VersionString);
            _sender = optionTabPage;

            projectFilePathTextBox.Initialize();
            projectOutputPathTextBox.Initialize();
            projectToImportTextBox.Initialize();

            _projectConfigurations = ProjectConfiguration.Load().ToList();
            if (_projectConfigurations.Any())
            {
                projectsListBox.Items.AddRange(_projectConfigurations.Select(item => item.Name).Cast <object>().ToArray());
                projectsListBox.SelectedIndex = 0;
            }
            else
            {
                shareProjectRadioButton.Enabled = false;
            }
        }
Example #29
0
        private static void ConfigureDynamics(IServiceCollection services, ProjectConfiguration project, ProjectResource projectResource, Serilog.ILogger logger)
        {
            Debug.Assert(services != null, "Required ServiceCollection is null");
            Debug.Assert(project != null, "Required ProjectConfiguration is null");
            Debug.Assert(projectResource != null, "Required ProjectResource is null");
            Debug.Assert(projectResource.Type == ProjectType.Dynamics, "Project type must be Dynamics");

            string projectResourceKey = project.Id + "-dynamics";

            // add authorization HttpClient
            services.AddHttpClient(projectResourceKey + "-authorization", configure => configure.BaseAddress = projectResource.AuthorizationUri)
            ;

            // add odata HttpClient
            // note: I do not like this IoC anti-pattern where we are using the service locator directly, however,
            //       there are many named dependencies. There may be an opportunity to address this in the future

            services.AddHttpClient(projectResourceKey, configure =>
            {
                configure.BaseAddress = projectResource.BaseAddress;

                // use the API Gateway if required
                if (projectResource.BaseAddress.Host != projectResource.Resource.Host)
                {
                    configure.DefaultRequestHeaders.Add("RouteToHost", projectResource.Resource.Host);
                }
            })
            .AddHttpMessageHandler((serviceProvider) =>
            {
                // build the token service that talk to the OAuth endpoint
                IHttpClientFactory httpClientFactory = serviceProvider.GetRequiredService <IHttpClientFactory>();
                HttpClient httpClient = httpClientFactory.CreateClient(projectResourceKey + "-authorization");

                // create the handler that will authenticate the call and add authorization header
                ILogger <OAuthClient> logger = serviceProvider.GetRequiredService <ILogger <OAuthClient> >();
                ITokenCache tokenCache       = serviceProvider.GetRequiredService <ITokenCache>();
                ITokenService tokenService   = new OAuthTokenService(new OAuthClient(httpClient, logger), tokenCache);
                var handler = new TokenAuthorizationHandler(tokenService, CreateOAuthOptions(projectResource));
                return(handler);
            });
        }
        /// <summary>
        /// Destructures project and resource for logging.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="projectResource">The project resource.</param>
        /// <returns></returns>
        private static object Destructure(ProjectConfiguration project, ProjectResource projectResource)
        {
            if (projectResource.Type == ProjectType.Dynamics)
            {
                return(new
                {
                    project.Name,
                    Resource = new
                    {
                        projectResource.Type,
                        projectResource.ApiGatewayHost,
                        projectResource.ApiGatewayPolicy,
                        projectResource.Resource
                    }
                });
            }

            if (projectResource.Type == ProjectType.SharePoint)
            {
                return(new
                {
                    project.Name,
                    Resource = new
                    {
                        projectResource.Type,
                        projectResource.ApiGatewayHost,
                        projectResource.ApiGatewayPolicy,
                        projectResource.RelyingPartyIdentifier
                    }
                });
            }

            return(new
            {
                project.Name,
                Resource = new
                {
                    projectResource.Type
                }
            });
        }
        /// <summary>
        /// Produces a string containing each dimension's value, in idiomatic order (configuration, platform, then any targets),
        /// such as <c>Debug|AnyCPU|net7.0</c>.
        /// </summary>
        /// <remarks>
        /// Calling <c>ToString</c> on <see cref="ProjectConfiguration"/> excludes the target framework from the first configuration,
        /// meaning it is not suitable when the full set of dimensions is needed.
        /// </remarks>
        /// <param name="projectConfiguration"></param>
        /// <returns></returns>
        internal static string GetDisplayString(this ProjectConfiguration projectConfiguration)
        {
            // ImmutableDictionary does not preserve order, so we manually produce the idiomatic order

            IImmutableDictionary <string, string> dims = projectConfiguration.Dimensions;

            var sb = new StringBuilder();

            // Configuration and platform are always first
            if (dims.TryGetValue(ConfigurationGeneral.ConfigurationProperty, out string?configuration))
            {
                Append(configuration);
            }
            if (dims.TryGetValue(ConfigurationGeneral.PlatformProperty, out string?platform))
            {
                Append(platform);
            }

            // Any other dimensions later
            foreach ((string name, string value) in dims)
            {
                if (StringComparers.ConfigurationDimensionNames.Equals(name, ConfigurationGeneral.ConfigurationProperty) ||
                    StringComparers.ConfigurationDimensionNames.Equals(name, ConfigurationGeneral.PlatformProperty))
                {
                    continue;
                }

                Append(value);
            }

            return(sb.ToString());

            void Append(string s)
            {
                if (sb.Length != 0)
                {
                    sb.Append('|');
                }
                sb.Append(s);
            }
        }
        public string GetScript(IItem aItem, string aSolutionPath)
        {
            string containingDirectoryPath = string.Empty;
            string script = $"{ScriptConstants.kScriptBeginning} ''{GetFilePath()}''";

            if (aItem is SelectedProjectItem)
            {
                ProjectItem projectItem       = aItem.GetObject() as ProjectItem;
                string      containingProject = projectItem.ContainingProject.FullName;
                script = $"{script} {ScriptConstants.kProject} ''{containingProject}'' " +
                         $"{ScriptConstants.kFile} ''{projectItem.Properties.Item("FullPath").Value}'' {ScriptConstants.kActiveConfiguration} " +
                         $"''{ProjectConfiguration.GetConfiguration(projectItem.ContainingProject)}|{ProjectConfiguration.GetPlatform(projectItem.ContainingProject)}''";
            }
            else if (aItem is SelectedProject)
            {
                Project project = aItem.GetObject() as Project;
                script = $"{script} {ScriptConstants.kProject} ''{project.FullName}'' {ScriptConstants.kActiveConfiguration} " +
                         $"''{ProjectConfiguration.GetConfiguration(project)}|{ProjectConfiguration.GetPlatform(project)}''";
            }
            return($"{script} {mParameters} {ScriptConstants.kDirectory} ''{aSolutionPath}'' {ScriptConstants.kLiteral}'");
        }
        public Task <bool> AllowProjectLoadAsync(bool isNewProject, ProjectConfiguration activeConfiguration, CancellationToken cancellationToken = default)
        {
            ProjectType?projectType = GetCurrentProjectType();

            if (projectType == null)    // Unrecognized, probably a Shared Project
            {
                return(TaskResult.True);
            }

            foreach (string capability in projectType.Capabilities)
            {
                if (!_projectCapabilitiesService.Contains(capability))
                {
                    // Throw instead of returning false so that we can control message and the HRESULT
                    throw new COMException(string.Format(CultureInfo.CurrentCulture, Resources.ProjectLoadedWithWrongProjectType, _project.FullPath),
                                           HResult.Fail);
                }
            }

            return(TaskResult.True);
        }
        public IWorkspaceProjectContext GetInnerProjectContext(ProjectConfiguration projectConfiguration, out bool isActiveConfiguration)
        {
            if (projectConfiguration.IsCrossTargeting())
            {
                var targetFramework = projectConfiguration.Dimensions[TargetFrameworkProjectConfigurationDimensionProvider.TargetFrameworkPropertyName];
                isActiveConfiguration = string.Equals(targetFramework, _activeTargetFramework);
                return(_configuredProjectContextsByTargetFramework.TryGetValue(targetFramework, out IWorkspaceProjectContext projectContext) ?
                       projectContext :
                       null);
            }
            else
            {
                isActiveConfiguration = true;
                if (_configuredProjectContextsByTargetFramework.Count > 1)
                {
                    return(null);
                }

                return(InnerProjectContexts.Single());
            }
        }
Example #35
0
        public void Generate(CoddeeSolutionInfo solution, ProjectConfiguration project, TableImportArgumentsViewModel args, Stream stream)
        {
            _project  = project;
            _solution = solution;
            var compileUnit     = new CodeCompileUnit();
            var nameSpace       = new CodeNamespace(project.DefaultNamespace);
            var usingsNamespace = new CodeNamespace();

            usingsNamespace.Imports.Add(new CodeNamespaceImport("System"));
            usingsNamespace.Imports.Add(new CodeNamespaceImport("Coddee"));
            AddNamepaceImports(usingsNamespace);
            var type = CreateType(args);

            AddBaseTypes(type, args);
            AddMembers(type, args);

            nameSpace.Types.Add(type);
            compileUnit.Namespaces.Add(usingsNamespace);
            compileUnit.Namespaces.Add(nameSpace);

            CodeDomProvider      provider = CodeDomProvider.CreateProvider("CSharp");
            CodeGeneratorOptions options  = new CodeGeneratorOptions
            {
                BlankLinesBetweenMembers = false,
                BracingStyle             = "C"
            };

            using (var ms = new MemoryStream())
            {
                using (var tempsw = new StreamWriter(ms))
                {
                    provider.GenerateCodeFromCompileUnit(compileUnit, tempsw, options);
                }
                var text = Encoding.UTF8.GetString(ms.ToArray());
                text = text.Replace("This code was generated by a tool.", "This code was generated by Coddee tool.");
                var bytes = Encoding.UTF8.GetBytes(text);
                stream.Write(bytes, 0, bytes.Length);
                stream.Flush();
            }
        }
        public ProjectConfiguration GetProjectConfiguration()
        {
            ProjectConfiguration projectConfiguration = new ProjectConfiguration
                                                            {
                                                                TaskTypes = new TaskTypeConfigurationCollection
                                                                                {
                                                                                    new TaskTypeConfiguration( ThreadingPlugIn.Name,
                                                                                                               project => new ThreadingPlugIn() )
                                                                                        {
                                                                                            AutoInclude = true,
                                                                                            Dependencies = new DependencyConfigurationCollection
                                                                                                               {
                                                                                                                   new DependencyConfiguration( "AspectWeaver" )
                                                                                                               }
                                                                                        }
                                                                                },
                                                                TaskFactories = new Dictionary<string, CreateTaskDelegate>
                                                                                    {
                                                                                        {ThreadingPlugIn.Name, project => new ThreadingPlugIn()}
                                                                                    }
                                                            };

            return projectConfiguration;
        }
 /// <remarks/>
 public void CreateNewProjectAsync(string SessionID, ProjectConfiguration Project) {
     this.CreateNewProjectAsync(SessionID, Project, null);
 }
 /// <remarks/>
 public void CreateNewProjectAsync(string SessionID, ProjectConfiguration Project, object userState) {
     if ((this.CreateNewProjectOperationCompleted == null)) {
         this.CreateNewProjectOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateNewProjectOperationCompleted);
     }
     this.InvokeAsync("CreateNewProject", new object[] {
                 SessionID,
                 Project}, this.CreateNewProjectOperationCompleted, userState);
 }
 public CxWSResponseProjectID CreateNewProject(string SessionID, ProjectConfiguration Project) {
     object[] results = this.Invoke("CreateNewProject", new object[] {
                 SessionID,
                 Project});
     return ((CxWSResponseProjectID)(results[0]));
 }
 /// <remarks/>
 public System.IAsyncResult BeginCreateNewProject(string SessionID, ProjectConfiguration Project, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("CreateNewProject", new object[] {
                 SessionID,
                 Project}, callback, asyncState);
 }
Example #41
0
 public GetConfigurationCommand(string key, ProjectConfiguration configuration)
 {
     _configuration = configuration;
     _key = key;
 }
 public UnsetProjectConfigurationCommand(string key, ProjectConfiguration configuration)
 {
     _key = key;
     _configuration = configuration;
 }
 public EnvironmentConfiguration(EnvironmentFlavour environmentFlavour, ProjectConfiguration defaultProjectConfiguration)
 {
     EnvironmentFlavour = environmentFlavour;
     DefaultProjectConfiguration = defaultProjectConfiguration;
 }
 public ListProjectConfigurationCommand(ProjectConfiguration global)
 {
     _global = global;
 }
 public CxWSBasicRepsonse UpdateProjectIncrementalConfiguration(string sessionID, long projectID, ProjectConfiguration projectConfiguration) {
     object[] results = this.Invoke("UpdateProjectIncrementalConfiguration", new object[] {
                 sessionID,
                 projectID,
                 projectConfiguration});
     return ((CxWSBasicRepsonse)(results[0]));
 }
 /// <remarks/>
 public void UpdateProjectIncrementalConfigurationAsync(string sessionID, long projectID, ProjectConfiguration projectConfiguration) {
     this.UpdateProjectIncrementalConfigurationAsync(sessionID, projectID, projectConfiguration, null);
 }
 public CxWSResponseProjectID CreateNewProject(string SessionID, ProjectConfiguration Project)
 {
     CxWSResponseProjectID result = _web_Service.CreateNewProject(SessionID, Project);
     return result;
 }
 public CxWSBasicRepsonse UpdateProjectIncrementalConfiguration(string sessionID, long projectID, ProjectConfiguration projectConfiguration)
 {
     CxWSBasicRepsonse result = _web_Service.UpdateProjectIncrementalConfiguration(sessionID, projectID, projectConfiguration);
     return result;
 }
        private static bool FilterPredicate(ProjectConfiguration item, IEnumerable<string> selectedGuids)
        {
            Contract.Requires(selectedGuids != null);

            return (item != null) && item.Project.ProjectTypeGuids.All(guid => selectedGuids.Contains(guid, StringComparer.OrdinalIgnoreCase));
        }
 public ISpecifyProjectConfigurationProperties SpecifyProjectConfigurationFor(ProjectFlavour projectFlavour)
 {
     var projectConfiguration = new ProjectConfiguration(projectFlavour);
     this.ProjectConfigurations.Add(projectConfiguration);
     return projectConfiguration;
 }
 public SetProjectConfigurationCommand(string key, string value, ProjectConfiguration configuration)
 {
     _key = key;
     _value = value;
     _configuration = configuration;
 }
 /// <remarks/>
 public System.IAsyncResult BeginUpdateProjectIncrementalConfiguration(string sessionID, long projectID, ProjectConfiguration projectConfiguration, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("UpdateProjectIncrementalConfiguration", new object[] {
                 sessionID,
                 projectID,
                 projectConfiguration}, callback, asyncState);
 }
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        private bool _NeedToAutoArchive(ProjectConfiguration config)
        {
            Debug.Assert(config != null);

            bool needToArchive = false;

            ProjectArchivingSettings arSet = config.ProjectArchivingSettings;
            if (arSet.IsAutoArchivingEnabled &&
                !arSet.IsArchive)
            {
                DateTime lastArchiveDate = arSet.LastArchivingDate != null ?
                    (DateTime)arSet.LastArchivingDate : config.CreationTime;

                DateTime mustArchiveDate = DateTime.Now.AddMonths(-arSet.AutoArchivingPeriod);
                if (mustArchiveDate.Date >= lastArchiveDate.Date)
                    needToArchive = true;
            }

            return needToArchive;
        }
 /// <remarks/>
 public void UpdateProjectIncrementalConfigurationAsync(string sessionID, long projectID, ProjectConfiguration projectConfiguration, object userState) {
     if ((this.UpdateProjectIncrementalConfigurationOperationCompleted == null)) {
         this.UpdateProjectIncrementalConfigurationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateProjectIncrementalConfigurationOperationCompleted);
     }
     this.InvokeAsync("UpdateProjectIncrementalConfiguration", new object[] {
                 sessionID,
                 projectID,
                 projectConfiguration}, this.UpdateProjectIncrementalConfigurationOperationCompleted, userState);
 }
        /// <summary>
        /// Handler for the page's Loaded event.
        /// </summary>
        /// <param name="sender">The object where the event handler is attached.</param>
        /// <param name="e">Event data.</param>
        private void _PageLoaded(object sender, RoutedEventArgs e)
        {
            ((MainWindow)App.Current.MainWindow).NavigationCalled +=
                new EventHandler(_GeneralPreferencesPageNavigationCalled);

            App.Current.MainWindow.StatusBar.SetStatus(this, null);

            Settings settings = Settings.Default;
            AllwaysAskBeforeDeletingButton.IsChecked =
                settings.IsAllwaysAskBeforeDeletingEnabled;
            FleetSetupWizardButton.IsChecked =
                settings.IsAutomaticallyShowFleetWizardEnabled;
            RouteLocationsVirtualWarningButton.IsChecked =
                settings.WarnUserIfVirtualLocationDetected;

            // Init breaks apply radio button group
            if (settings.IsAlwaysAskAboutApplyingBreaksToDefaultRoutes)
                IsAlwaysAksAboutApplyingBreaks.IsChecked = true;
            else if (settings.ApplyBreaksChangesToDefaultRoutes)
                ApplyBreaks.IsChecked = true;
            else
                DontApplyBreaks.IsChecked = true;

            // Init routes apply radio button group
            if (settings.IsAlwaysAskAboutApplyingDefaultRoutesToSheduledRoutes)
                AlwaysAskAboutApplyingRoutes.IsChecked = true;
            else if (settings.ApplyDefaultRoutesToSheduledRoutes)
                ApplyDefaultRoutesToScheduledRoutes.IsChecked = true;
            else
                DontApplyDefaultRoutesToScheduledRoutes.IsChecked = true;

            _UpdateArchiveSettings();

            // Initialize custom order properties control.
            _InitializeCustomOrderPropertiesControl();

            // Get configuration of the current project.
            _currentProjectConfiguration = App.Current.GetCurrentProjectConfiguration();
        }
Example #56
0
 public AddPackageCommand(string name, NugsDirectory nugsDirectory, ProjectConfiguration projectConfiguration, FileSystem fileSystem)
     : this(name, null, nugsDirectory, projectConfiguration, fileSystem)
 {
 }
        /// <summary>
        /// Handler for the page's Unloaded event.
        /// </summary>
        /// <param name="sender">The object where the event handler is attached.</param>
        /// <param name="e">Event data.</param>
        private void _PageUnloaded(object sender, RoutedEventArgs e)
        {
            // Unsubscribe from events.
            ((MainWindow)App.Current.MainWindow).NavigationCalled -= _GeneralPreferencesPageNavigationCalled;

            _SaveChanges();

            // Save collection of custom order properties.
            if (_currentProjectConfiguration != null)
            {
                // If this event occured collection of custom order properties should be valid.
                Debug.Assert(_customOrderPropertiesControl.DataIsValid());

                _SaveCustomOrderProperties();
            }

            _currentProjectConfiguration = null;
        }
Example #58
0
		private static Repository RepositoryFromConfiguration(ProjectConfiguration project) {
			return Repository.Open(
				project.Name,
				new DirectoryInfo(project.Path),
				project.Parameters.ToDictionary(p => (string)p.Key, p => p.Value));
		}
Example #59
0
        public object Build(
            CSharp.Assembly moduleToBuild,
            out System.Boolean success)
        {
            var assemblyModule = moduleToBuild as Bam.Core.BaseModule;
            var node = assemblyModule.OwningNode;
            var target = node.Target;
            var options = assemblyModule.Options as CSharp.OptionCollection;

            var moduleName = node.ModuleName;

            string platformName;
            switch ((options as CSharp.IOptions).Platform)
            {
                case CSharp.EPlatform.AnyCpu:
                    platformName = "AnyCPU";
                    break;

                case CSharp.EPlatform.X86:
                    platformName = "x86";
                    break;

                case CSharp.EPlatform.X64:
                case CSharp.EPlatform.Itanium:
                    platformName = "x64";
                    break;

                default:
                    throw new Bam.Core.Exception("Unrecognized platform");
            }

            ICSProject projectData = null;
            // TODO: want to remove this
            lock (this.solutionFile.ProjectDictionary)
            {
                if (this.solutionFile.ProjectDictionary.ContainsKey(moduleName))
                {
                    projectData = this.solutionFile.ProjectDictionary[moduleName] as ICSProject;
                }
                else
                {
                    var solutionType = Bam.Core.State.Get("VSSolutionBuilder", "SolutionType") as System.Type;
                    var SolutionInstance = System.Activator.CreateInstance(solutionType);
                    var ProjectExtensionProperty = solutionType.GetProperty("ProjectExtension");
                    var projectExtension = ProjectExtensionProperty.GetGetMethod().Invoke(SolutionInstance, null) as string;

                    var projectDir = node.GetModuleBuildDirectoryLocation().GetSinglePath();
                    var projectPathName = System.IO.Path.Combine(projectDir, moduleName);
                    projectPathName += projectExtension;

                    var projectType = VSSolutionBuilder.GetProjectClassType();
                    projectData = System.Activator.CreateInstance(projectType, new object[] { moduleName, projectPathName, node.Package.Identifier, assemblyModule.ProxyPath }) as ICSProject;

                    this.solutionFile.ProjectDictionary.Add(moduleName, projectData);
                }
            }

            {
                if (!projectData.Platforms.Contains(platformName))
                {
                    projectData.Platforms.Add(platformName);
                }
            }

            // solution folder
            {
                var groups = moduleToBuild.GetType().GetCustomAttributes(typeof(Bam.Core.ModuleGroupAttribute), true);
                if (groups.Length > 0)
                {
                    projectData.GroupName = (groups as Bam.Core.ModuleGroupAttribute[])[0].GroupName;
                }
            }

            if (node.ExternalDependents != null)
            {
                foreach (var dependentNode in node.ExternalDependents)
                {
                    if (dependentNode.ModuleName == moduleName)
                    {
                        continue;
                    }

                    // TODO: want to remove this
                    lock (this.solutionFile.ProjectDictionary)
                    {
                        if (this.solutionFile.ProjectDictionary.ContainsKey(dependentNode.ModuleName))
                        {
                            var dependentProject = this.solutionFile.ProjectDictionary[dependentNode.ModuleName];
                            projectData.DependentProjects.Add(dependentProject);
                        }
                    }
                }
            }

            // references
            // TODO: convert to var
            foreach (Bam.Core.Location location in (options as CSharp.IOptions).References)
            {
                var reference = location.GetSinglePath();
                projectData.References.Add(reference);
            }

            var configurationName = VSSolutionBuilder.GetConfigurationNameFromTarget(target, platformName);

            ProjectConfiguration configuration;
            lock (projectData.Configurations)
            {
                if (!projectData.Configurations.Contains(configurationName))
                {
                    // TODO: fix me?
                    configuration = new ProjectConfiguration(configurationName, projectData);
                    configuration.CharacterSet = EProjectCharacterSet.NotSet;
                    projectData.Configurations.Add((Bam.Core.BaseTarget)target, configuration);
                }
                else
                {
                    configuration = projectData.Configurations[configurationName];
                    projectData.Configurations.AddExistingForTarget((Bam.Core.BaseTarget)target, configuration);
                }
            }

            var fields = moduleToBuild.GetType().GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic);
            foreach (var field in fields)
            {
                // C# files
                {
                    var sourceFileAttributes = field.GetCustomAttributes(typeof(Bam.Core.SourceFilesAttribute), false);
                    if (null != sourceFileAttributes && sourceFileAttributes.Length > 0)
                    {
                        var sourceField = field.GetValue(moduleToBuild);
                        if (sourceField is Bam.Core.Location)
                        {
                            var file = sourceField as Bam.Core.Location;
                            var absolutePath = file.GetSinglePath();
                            if (!System.IO.File.Exists(absolutePath))
                            {
                                throw new Bam.Core.Exception("Source file '{0}' does not exist", absolutePath);
                            }

                            ProjectFile sourceFile;
                            lock (projectData.SourceFiles)
                            {
                                if (!projectData.SourceFiles.Contains(absolutePath))
                                {
                                    sourceFile = new ProjectFile(absolutePath);
                                    sourceFile.FileConfigurations = new ProjectFileConfigurationCollection();
                                    projectData.SourceFiles.Add(sourceFile);
                                }
                                else
                                {
                                    sourceFile = projectData.SourceFiles[absolutePath];
                                }
                            }
                        }
                        else if (sourceField is Bam.Core.FileCollection)
                        {
                            var sourceCollection = sourceField as Bam.Core.FileCollection;
                            // TODO: convert to var
                            foreach (Bam.Core.Location location in sourceCollection)
                            {
                                var absolutePath = location.GetSinglePath();
                                if (!System.IO.File.Exists(absolutePath))
                                {
                                    throw new Bam.Core.Exception("Source file '{0}' does not exist", absolutePath);
                                }

                                ProjectFile sourceFile;
                                lock (projectData.SourceFiles)
                                {
                                    if (!projectData.SourceFiles.Contains(absolutePath))
                                    {
                                        sourceFile = new ProjectFile(absolutePath);
                                        sourceFile.FileConfigurations = new ProjectFileConfigurationCollection();
                                        projectData.SourceFiles.Add(sourceFile);
                                    }
                                    else
                                    {
                                        sourceFile = projectData.SourceFiles[absolutePath];
                                    }
                                }
                            }
                        }
                        else
                        {
                            throw new Bam.Core.Exception("Field '{0}' of '{1}' should be of type Bam.Core.File or Bam.Core.FileCollection, not '{2}'", field.Name, node.ModuleName, sourceField.GetType().ToString());
                        }
                    }
                }

                // WPF application definition .xaml file
                {
                    var xamlFileAttributes = field.GetCustomAttributes(typeof(CSharp.ApplicationDefinitionAttribute), false);
                    if (null != xamlFileAttributes && xamlFileAttributes.Length > 0)
                    {
                        var sourceField = field.GetValue(moduleToBuild);
                        if (sourceField is Bam.Core.Location)
                        {
                            var file = sourceField as Bam.Core.Location;
                            var absolutePath = file.GetSinglePath();
                            if (!System.IO.File.Exists(absolutePath))
                            {
                                throw new Bam.Core.Exception("Application definition file '{0}' does not exist", absolutePath);
                            }

            #if false
                            // TODO: in theory, this file should be generated in VS, but it doesn't seem to
                            string csPath = absolutePath + ".cs";
                            if (!System.IO.File.Exists(csPath))
                            {
                                throw new Bam.Core.Exception("Associated source file '{0}' to application definition file '{1}' does not exist", csPath, absolutePath);
                            }
            #endif

                            projectData.ApplicationDefinition = new ProjectFile(absolutePath);
                        }
                        else if (sourceField is Bam.Core.FileCollection)
                        {
                            var sourceCollection = sourceField as Bam.Core.FileCollection;
                            if (sourceCollection.Count != 1)
                            {
                                throw new Bam.Core.Exception("There can be only one application definition");
                            }

                            // TODO: convert to var
                            foreach (string absolutePath in sourceCollection)
                            {
                                if (!System.IO.File.Exists(absolutePath))
                                {
                                    throw new Bam.Core.Exception("Application definition file '{0}' does not exist", absolutePath);
                                }

            #if false
                                // TODO: in theory, this file should be generated in VS, but it doesn't seem to
                                string csPath = absolutePath + ".cs";
                                if (!System.IO.File.Exists(csPath))
                                {
                                    throw new Bam.Core.Exception("Associated source file '{0}' to application definition file '{1}' does not exist", csPath, absolutePath));
                                }
            #endif

                                projectData.ApplicationDefinition = new ProjectFile(absolutePath);
                            }
                        }
                        else
                        {
                            throw new Bam.Core.Exception("Field '{0}' of '{1}' should be of type Bam.Core.File or Bam.Core.FileCollection, not '{2}'", field.Name, node.ModuleName, sourceField.GetType().ToString());
                        }
                    }
                }

                // WPF page .xaml files
                {
                    var xamlFileAttributes = field.GetCustomAttributes(typeof(CSharp.PagesAttribute), false);
                    if (null != xamlFileAttributes && xamlFileAttributes.Length > 0)
                    {
                        var sourceField = field.GetValue(moduleToBuild);
                        if (sourceField is Bam.Core.Location)
                        {
                            var file = sourceField as Bam.Core.Location;
                            var absolutePath = file.GetSinglePath();
                            if (!System.IO.File.Exists(absolutePath))
                            {
                                throw new Bam.Core.Exception("Page file '{0}' does not exist", absolutePath);
                            }

                            lock (projectData.Pages)
                            {
                                if (!projectData.Pages.Contains(absolutePath))
                                {
                                    projectData.Pages.Add(new ProjectFile(absolutePath));
                                }
                            }
                        }
                        else if (sourceField is Bam.Core.FileCollection)
                        {
                            var sourceCollection = sourceField as Bam.Core.FileCollection;
                            // TODO: convert to var
                            foreach (string absolutePath in sourceCollection)
                            {
                                if (!System.IO.File.Exists(absolutePath))
                                {
                                    throw new Bam.Core.Exception("Page file '{0}' does not exist", absolutePath);
                                }

                                var csPath = absolutePath + ".cs";
                                if (!System.IO.File.Exists(csPath))
                                {
                                    throw new Bam.Core.Exception("Associated source file '{0}' to page file '{1}' does not exist", csPath, absolutePath);
                                }

                                lock (projectData.Pages)
                                {
                                    if (!projectData.Pages.Contains(absolutePath))
                                    {
                                        projectData.Pages.Add(new ProjectFile(absolutePath));
                                    }
                                }
                            }
                        }
                        else
                        {
                            throw new Bam.Core.Exception("Field '{0}' of '{1}' should be of type Bam.Core.File or Bam.Core.FileCollection, not '{2}'", field.Name, node.ModuleName, sourceField.GetType().ToString());
                        }
                    }
                }
            }

            configuration.Type = EProjectConfigurationType.Application;

            var toolName = "VCSCompiler";
            var vcsCompiler = configuration.GetTool(toolName);
            if (null == vcsCompiler)
            {
                vcsCompiler = new ProjectTool(toolName);
                configuration.AddToolIfMissing(vcsCompiler);
                configuration.OutputDirectory = moduleToBuild.Locations[CSharp.Assembly.OutputDir];

                if (options is VisualStudioProcessor.IVisualStudioSupport)
                {
                    var visualStudioProjectOption = options as VisualStudioProcessor.IVisualStudioSupport;
                    var settingsDictionary = visualStudioProjectOption.ToVisualStudioProjectAttributes(target);

                    foreach (var setting in settingsDictionary)
                    {
                        vcsCompiler[setting.Key] = setting.Value;
                    }
                }
                else
                {
                    throw new Bam.Core.Exception("Assembly options does not support VisualStudio project translation");
                }
            }

            success = true;
            return projectData;
        }