# Unreal opening new instance of Visual Studio every time a class is added

**URL:** <https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352>\
**Category:** Pipeline & Plugins\
**Tags:** UE4-18, unreal-engine, Visual-Studio, CPP, question\
**Created:** [December 15, 2017, 8:27pm UTC](https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352 "2017-12-15T20:27:59Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_b25516ac](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b25516ac](https://forums.unrealengine.com/u/anonymous_user_b25516ac)\
**Post date:** [December 15, 2017, 8:27pm UTC](https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352/1 "2017-12-15T20:27:59Z")

</div>

I already have my project open in Visual Studio, but Unreal still opens up a new instance each time I add a new class. This did not happen before 4.18.2. Is there a way to prevent this?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b25516ac](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b25516ac](https://forums.unrealengine.com/u/anonymous_user_b25516ac)\
**Post date:** [December 16, 2017, 4:18am UTC](https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352/2 "2017-12-16T04:18:25Z")

</div>

I see that this is actually a known issue and that a fix is upcoming. Would like to expand a little on my issue in case others have experienced the same but will wait for the update. In addition to opening extra instances of Visual Studio, this bug also loads the new c++ file in QT Creator.

Others have mentioned that, after opening a new VS window, the "Loading Visual Studio…"message in the UE IDE remains. After a few minutes - this opens yet another instance of VS for me as well as an instance of QT. Very strange bug and hoping the fix solves it.

---

<div class="post-metadata">

**Author:** ![Cabal1996](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cabal1996](https://forums.unrealengine.com/u/Cabal1996)\
**Post date:** [January 1, 2018, 11:21pm UTC](https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352/3 "2018-01-01T23:21:18Z")

</div>

I am expiriance the same issue. If I create new class or even try to edit existing, UE opens new instance of visual studio.Some times it opens two of them.

---

<div class="post-metadata">

**Author:** ![Cabal1996](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cabal1996](https://forums.unrealengine.com/u/Cabal1996)\
**Post date:** [January 2, 2018, 2:27pm UTC](https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352/4 "2018-01-02T14:27:25Z")

</div>

I am expiriance the same issue. If I create new class or even try to edit existing, UE opens new instance of visual studio.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b25516ac](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b25516ac](https://forums.unrealengine.com/u/anonymous_user_b25516ac)\
**Post date:** [January 2, 2018, 2:29pm UTC](https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352/5 "2018-01-02T14:29:28Z")

</div>

This is a known issue with UE and a fix has been made. I believe it is supposed to be included in the next big release.

---

<div class="post-metadata">

**Author:** ![Milly01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Milly01](https://forums.unrealengine.com/u/Milly01)\
**Post date:** [January 9, 2018, 10:39am UTC](https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352/6 "2018-01-09T10:39:11Z")

</div>

I’ve had this and what worked for me is to make a slight engine modification if you are running from source.

It seems to only be a problem if your projects are not in the same directory as your engine, as it’s only checking the relative path of the project or something. In VisualStudioSourceCodeAccessor.cpp, line 223 change it from:

```
if (Filename == InSolutionPath)

```

to

```
FString AbsoluteSolutionPath = FPaths::ConvertRelativePathToFull(InSolutionPath);
if (Filename == InSolutionPath || Filename == AbsoluteSolutionPath)

```

That seemed to do the trick for us.

---

<div class="post-metadata">

**Author:** ![StefBarz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@StefBarz](https://forums.unrealengine.com/u/StefBarz)\
**Post date:** [January 20, 2018, 1:00pm UTC](https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352/7 "2018-01-20T13:00:21Z")

</div>

I tried this in 4.19 preview where the issue is supposed to be already fixed but its not. Now it doesn’t spawn a new instance of VS2017 but it doesn’t actually do anything at all, I can’t open a class from the editor with this ‘fix’.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b25516ac](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b25516ac](https://forums.unrealengine.com/u/anonymous_user_b25516ac)\
**Post date:** [January 20, 2018, 1:37pm UTC](https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352/8 "2018-01-20T13:37:03Z")

</div>

I had tried this in 4.18.2 as well with the same result. I get an error along the lines that UE cannot open Visual Studio. This may be due to the fact that I am not practiced at using my own custom builds. It is disappointing that 4.19 has not fixed this yet.

---

<div class="post-metadata">

**Author:** ![MadeInAm3rica](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MadeInAm3rica](https://forums.unrealengine.com/u/MadeInAm3rica)\
**Post date:** [July 24, 2018, 10:47pm UTC](https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352/9 "2018-07-24T22:47:07Z")

</div>

I resolved this by simply creating the project in the same directory as the engine source  
V4.20

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b25516ac](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b25516ac](https://forums.unrealengine.com/u/anonymous_user_b25516ac)\
**Post date:** [July 25, 2018, 12:10am UTC](https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352/10 "2018-07-25T00:10:05Z")

</div>

That doesn’t solve my issue as my engine builds and projects are kept on different disks due to work policy.

---

<div class="post-metadata">

**Author:** ![Alps709](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Alps709](https://forums.unrealengine.com/u/Alps709)\
**Post date:** [September 2, 2025, 2:29pm UTC](https://forums.unrealengine.com/t/unreal-opening-new-instance-of-visual-studio-every-time-a-class-is-added/412352/11 "2025-09-02T14:29:04Z")

</div>

I am also getting this issue even in UE5.5.1 as I have my project directory seperate from my engine source.

I was able to fix it by going into the VisualStudioSourceCodeAccessor.cpp, at line 1100 there is a lambda that sorts the different instances of solutions it finds for unreal.  
This doesn’t seem to actually sort it correctly, so I added the following code to get your project name:

// get project dir name  
const FString& ProjectFile = FPaths::GetProjectFilePath();  
const FString& ProjectName = FPaths::GetBaseFilename(ProjectFile);

And then added this code inside the sorting lambda, so it prioritises VS instances for the current project over anything else:

//if the project directory is the same sort to front  
if (InLHS.SolutionFile.Contains(ProjectName, ESearchCase::IgnoreCase))  
{  
return true;  
}
