/// <summary>
        /// Prepares the target.
        /// </summary>
        /// <param name="writerSetup">The target setup.</param>
        /// <returns>
        /// The <see cref="T:Sundew.Generation.Common.Target" />.
        /// </returns>
        public async Task <IProject> GetTargetAsync(IMsBuildWriterSetup writerSetup)
        {
            if (string.IsNullOrEmpty(writerSetup.Target))
            {
                throw new ArgumentNullException(nameof(writerSetup.Target), "Target cannot be null.");
            }

            var fullTargetPath = Path.GetFullPath(writerSetup.Target);

            if (writerSetup.AddFilesToProject)
            {
                this.workspaceTask = MSBuildWorkspaceFactory.CreateAsync();
            }

            var fileInfo       = new FileInfo(fullTargetPath);
            var projectContent = XDocument.Parse(await IO.File.ReadAllTextAsync(fullTargetPath).ConfigureAwait(false));
            var fallbackName   = Path.GetFileNameWithoutExtension(fileInfo.Name);
            var projectName    = ProjectHelper.GetAssemblyName(projectContent, fallbackName);

            return(new Project(
                       projectName,
                       fullTargetPath,
                       fileInfo.DirectoryName,
                       ProjectHelper.GetNamespace(projectContent, fallbackName),
                       writerSetup.FileNameSuffix + writerSetup.FileExtension));
        }
        /// <summary>
        /// Gets the models.
        /// </summary>
        /// <param name="setup">The setup.</param>
        /// <param name="modelSetup">The model setup.</param>
        /// <returns>
        /// The models.
        /// </returns>
        public async Task <IReadOnlyList <IModelInfo <Compilation?> > > GetModelsAsync(ICompilationsSetup setup, IModelSetup?modelSetup)
        {
            var msBuildWorkspace = await MSBuildWorkspaceFactory.CreateAsync().ConfigureAwait(false);

            if (setup.CompilationPaths == null)
            {
                return(Array.Empty <IModelInfo <Compilation?> >());
            }

            return(await setup.CompilationPaths.SelectAsync(async filePath =>
            {
                var project = await msBuildWorkspace.OpenProjectAsync(filePath).ConfigureAwait(false);
                return new ModelInfo <Compilation?>(await project.GetCompilationAsync().ConfigureAwait(false), filePath);
            }).ConfigureAwait(false));
        }