madskristensen / NpmTaskRunner

Visual Studio extension
Other
88 stars 32 forks source link

VS2019: NPM Task Runner Starts two instances of task on project opened #71

Closed jesperbjensen closed 5 years ago

jesperbjensen commented 5 years ago

Installed product versions

Description

If you open a .sln file directly (by right clicking on the VS icon in the task bar - or open it via File Explorer) - then tasks set to start at Project Open is started two times. This does not happen in VS2017.

Steps to recreate

  1. Create a new ASP.NET Application (not core)
  2. run npm init in the folder
  3. In the Task Runner - set the test task to start when the project is opened
  4. Close Visual studio - and open the solution directly - by using the .sln file

Current behavior

The test task is executed TWO times

Expected behavior

The test task is execute ONE time

It sounds very strange to be the extensions fault - and it sounds like a bug in Visual Studio 2019 - but I'm not really sure how to report it to the Visual Studio Team, as I don't really know how the extension is called two times - and if that behavior is by design - or not.

usermax83 commented 5 years ago

I'm also having this issue with VS 2019 (installed it today). The only "fix" for now is to open VS, and then pick the solution from the list.

david-hollifield commented 5 years ago

It happens for me even when picking the solution from the list. VS 2019 (installed today)

ashrafsabrym commented 5 years ago

I confirm this issue occurs on VS2019 however the solution is opened. Visual Studio version: 16.0.0 Community Edition This extension version: 1.4.90 Webpack Task Runner extension version: 1.5.94

kbkjeldsen commented 5 years ago

I'm having the same issue.

Visual Studio v16.0.0 Professional NPM Task Runner v1.4.90 Yarn v1.15.2

jesperbjensen commented 5 years ago

I have reported the problem using Visual Studio Feedback tool: https://developercommunity.visualstudio.com/content/problem/526923/task-runner-explorer-calls-task-two-times-on-proje.html

I have tried to debug the NPM Task Runner, and it looks like the problem is in the Visual Studio part of the Task Runner

JaapMosselman commented 5 years ago

I have the same issue. In my solution I have 2 projects which have both an NPM task started on opening. The strange thing is, that only for 1 project 2 instances are started and it is always the same project. For the other project, just one instance is started.

jesperbjensen commented 5 years ago

@JaapMosselman Does one of the projects have NuGet packages and the other does not? (or maybe using the new vs old NuGet system or csproj format) It looks to me like the first instance starts really fast - and the other one starts after NuGet restore (it does not have to be the NuGet task that triggers it - it can be some other thing that runs after NuGet)

JaapMosselman commented 5 years ago

@jesperbjensen It are just old style csproj files (ASP.NET 4.5 MVC). Both use NuGet packages. Don't know how I can see new vs old NuGet system. Don't see difference. One of the tasks start early. Then some seconds later two tasks (for the 2 projects) are started.

waynebrantley commented 5 years ago

I have this same problem. The project uses old verbose csproj file formats and targets ASP.NET 4.5 MVC full framework. If I open the solution in VS2017, each task is run once (perfect). If I open the solution in VS2019, each task is run twice (not good).

Supposedly this will be fixed in version 16.2, which is in preview 4 now, so hopefully we will see this soon.

jesperbjensen commented 5 years ago

Visual Studio 16.2 fixes this issue for me. I will close this issue.

If 16.2 does not solve it for you - then I think the right place to comment on it is on the Visual Studio issue: https://developercommunity.visualstudio.com/content/problem/526923/task-runner-explorer-calls-task-two-times-on-proje.html