public async Task <NuGetProject> GetOrCreateProjectAsync(EnvDTE.Project project, INuGetProjectContext projectContext) { await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var projectSafeName = await EnvDTEProjectUtility.GetCustomUniqueNameAsync(project); var nuGetProject = GetNuGetProject(projectSafeName); // if the project does not exist in the solution (this is true for new templates) // create it manually if (nuGetProject == null) { nuGetProject = CreateNuGetProject(project, projectContext); } return(nuGetProject); }