Skip to content

Commit 3bfd760

Browse files
Workaround VS caching issue - fixes #586
1 parent fb4b09a commit 3bfd760

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

CodeConverter/CSharp/ProjectExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ public static ProjectInfo ToProjectInfo(this Project project, ProjectId projectI
3333

3434
public static Project ToProjectFromAnyOptions(this Project project, CompilationOptions compilationOptions, ParseOptions parseOptions)
3535
{
36-
var projectInfo = project.ToProjectInfo(project.Id, project.Name, compilationOptions,
36+
// Use a new id to workaround VS caching issue first reported here: https://github.com/icsharpcode/CodeConverter/issues/586
37+
var newProjectId = ProjectId.CreateNewId("ConvertedProject");
38+
var projectInfo = project.ToProjectInfo(newProjectId, project.Name, compilationOptions,
3739
project.ProjectReferences, parseOptions);
3840
var convertedSolution = project.Solution.RemoveProject(project.Id).AddProject(projectInfo);
39-
return convertedSolution.GetProject(project.Id);
41+
return convertedSolution.GetProject(newProjectId);
4042
}
4143

4244
public static string GetDirectoryPath(this Project proj)

0 commit comments

Comments
 (0)