{"action":"opened","issue":{"url":"https://api.github.com/repos/aspnet/Tooling/issues/642","repository_url":"https://api.github.com/repos/aspnet/Tooling","labels_url":"https://api.github.com/repos/aspnet/Tooling/issues/642/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Tooling/issues/642/comments","events_url":"https://api.github.com/repos/aspnet/Tooling/issues/642/events","html_url":"https://github.com/aspnet/Tooling/issues/642","id":163452882,"number":642,"title":"restore fails in VS, but not in powershell","user":{"login":"esargent","id":14894721,"avatar_url":"https://avatars.githubusercontent.com/u/14894721?v=3","gravatar_id":"","url":"https://api.github.com/users/esargent","html_url":"https://github.com/esargent","followers_url":"https://api.github.com/users/esargent/followers","following_url":"https://api.github.com/users/esargent/following{/other_user}","gists_url":"https://api.github.com/users/esargent/gists{/gist_id}","starred_url":"https://api.github.com/users/esargent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esargent/subscriptions","organizations_url":"https://api.github.com/users/esargent/orgs","repos_url":"https://api.github.com/users/esargent/repos","events_url":"https://api.github.com/users/esargent/events{/privacy}","received_events_url":"https://api.github.com/users/esargent/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-01T18:43:17Z","updated_at":"2016-07-01T18:43:17Z","closed_at":null,"body":"I have an aspnetcore app project and a test project. Often, when I edit project.json the restore will fail in the test project with the error `An item with the same key has already been added. Key: MyMVCProject`\r\n\r\nBut if I drop down to powershell and run `dotnet restore` it works.\r\n\r\nSometimes the error message remains in the Error List window, BUT, the visual indicator in Solution Explorer resolves for the test project and I can compile successfully (which will remove the error list message if it exists.)\r\n\r\nIn this same scenario, I can re-run \"restore packages\" from the Visual Studio menu in Solution Explorer and continue to get the error, but dropping down to the powershell command fixes the issue.\r\n\r\nThe VS output log doesn't show any errors:\r\n`\r\nRetrieving package 'Newtonsoft.Json 9.0.1' from 'Microsoft and .NET'.\r\n  GET https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/Packages(Id='Newtonsoft.Json',Version='9.0.1')\r\n  OK https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/Packages(Id='Newtonsoft.Json',Version='9.0.1') 101ms\r\nInstalling NuGet package Newtonsoft.Json.9.0.1.\r\nSuccessfully installed 'Newtonsoft.Json 9.0.1' to My.Portal.Test\r\nExecuting nuget actions took 402.06 ms\r\n========== Finished ==========\r\nTime Elapsed: 00:00:00.8570988\r\nPATH=.\\node_modules\\.bin;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Web\\External;%PATH%\r\nC:\\Program Files\\dotnet\\dotnet.exe restore \"C:\\code\\MyPortalSolution\\.vs\\restore.dg\"\r\nlog  : Restoring packages for C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\project.json...\r\nlog  : Writing lock file to disk. Path: C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\project.lock.json\r\nlog  : C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\My.Portal.Test.xproj\r\nlog  : Restore completed in 19900ms.\r\nPATH=.\\node_modules\\.bin;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Web\\External;%PATH%\r\nC:\\Program Files\\dotnet\\dotnet.exe restore \"C:\\code\\MyPortalSolution\\.vs\\restore.dg\"\r\nlog  : Restoring packages for C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\project.json...\r\nlog  : Writing lock file to disk. Path: C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\project.lock.json\r\nlog  : C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\My.Portal.Test.xproj\r\nlog  : Restore completed in 17630ms.\r\nPATH=.\\node_modules\\.bin;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Web\\External;%PATH%\r\nC:\\Program Files\\dotnet\\dotnet.exe restore \"C:\\code\\MyPortalSolution\\.vs\\restore.dg\"\r\nlog  : Restoring packages for C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\project.json...\r\nlog  : Writing lock file to disk. Path: C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\project.lock.json\r\nlog  : C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\My.Portal.Test.xproj\r\nlog  : Restore completed in 10840ms.\r\nPATH=.\\node_modules\\.bin;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Web\\External;%PATH%\r\nC:\\Program Files\\dotnet\\dotnet.exe restore \"C:\\code\\MyPortalSolution\\.vs\\restore.dg\"\r\nlog  : Restoring packages for C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\project.json...\r\nlog  : Restoring packages for C:\\code\\MyPortalSolution\\src\\MyMVC\\project.json...\r\nlog  : Restoring packages for tool 'BundlerMinifier.Core' in C:\\code\\MyPortalSolution\\src\\MyMVC\\project.json...\r\nlog  : Restoring packages for tool 'Microsoft.AspNetCore.Razor.Tools' in C:\\code\\MyPortalSolution\\src\\MyMVC\\project.json...\r\nlog  : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in C:\\code\\MyPortalSolution\\src\\MyMVC\\project.json...\r\nlog  : Writing lock file to disk. Path: C:\\code\\MyPortalSolution\\src\\MyMVC\\project.lock.json\r\nlog  : C:\\code\\MyPortalSolution\\src\\MyMVC\\My.Mvc.xproj\r\nlog  : Restore completed in 18922ms.\r\nlog  : Writing lock file to disk. Path: C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\project.lock.json\r\nlog  : C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\My.Portal.Test.xproj\r\nlog  : Restore completed in 23571ms.\r\nPATH=.\\node_modules\\.bin;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Web\\External;%PATH%\r\nC:\\Program Files\\dotnet\\dotnet.exe restore \"C:\\code\\MyPortalSolution\\.vs\\restore.dg\"\r\nlog  : Restoring packages for C:\\code\\MyPortalSolution\\src\\MyMVC\\project.json...\r\nlog  : Restoring packages for C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\project.json...\r\nlog  : Restoring packages for tool 'BundlerMinifier.Core' in C:\\code\\MyPortalSolution\\src\\MyMVC\\project.json...\r\nlog  : Restoring packages for tool 'Microsoft.AspNetCore.Razor.Tools' in C:\\code\\MyPortalSolution\\src\\MyMVC\\project.json...\r\nlog  : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in C:\\code\\MyPortalSolution\\src\\MyMVC\\project.json...\r\nlog  : Writing lock file to disk. Path: C:\\code\\MyPortalSolution\\src\\MyMVC\\project.lock.json\r\nlog  : C:\\code\\MyPortalSolution\\src\\MyMVC\\My.Mvc.xproj\r\nlog  : Restore completed in 18746ms.\r\nlog  : Writing lock file to disk. Path: C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\project.lock.json\r\nlog  : C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\My.Portal.Test.xproj\r\nlog  : Restore completed in 23201ms.\r\nPATH=.\\node_modules\\.bin;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Web\\External;%PATH%\r\nC:\\Program Files\\dotnet\\dotnet.exe restore \"C:\\code\\MyPortalSolution\\.vs\\restore.dg\"\r\nlog  : Restoring packages for C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\project.json...\r\nlog  : Restoring packages for C:\\code\\MyPortalSolution\\src\\MyMVC\\project.json...\r\nlog  : Restoring packages for tool 'BundlerMinifier.Core' in C:\\code\\MyPortalSolution\\src\\MyMVC\\project.json...\r\nlog  : Restoring packages for tool 'Microsoft.AspNetCore.Razor.Tools' in C:\\code\\MyPortalSolution\\src\\MyMVC\\project.json...\r\nlog  : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in C:\\code\\MyPortalSolution\\src\\MyMVC\\project.json...\r\nlog  : Writing lock file to disk. Path: C:\\code\\MyPortalSolution\\src\\MyMVC\\project.lock.json\r\nlog  : C:\\code\\MyPortalSolution\\src\\MyMVC\\My.Mvc.xproj\r\nlog  : Restore completed in 18885ms.\r\nlog  : Writing lock file to disk. Path: C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\project.lock.json\r\nlog  : C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\\My.Portal.Test.xproj\r\nlog  : Restore completed in 23483ms.`\r\n\r\nIf I build in VS prior to running restore in powershell, I get an error.\r\n\r\n`1>------ Build started: Project: My.Mvc, Configuration: Debug Any CPU ------\r\n1>Build started 7/1/2016 11:35:54 AM.\r\n1>     1>\r\n1>CoreCompile:\r\n1>         C:\\Program Files\\dotnet\\dotnet.exe build \"C:\\code\\MyPortalSolution\\src\\MyMVC\" --configuration Debug --no-dependencies\r\n1>         Project MyMVC (.NETCoreApp,Version=v1.0) will be compiled because inputs were modified\r\n1>         Compiling MyMVC for .NETCoreApp,Version=v1.0\r\n1>         Compilation succeeded.\r\n1>             0 Warning(s)\r\n1>             0 Error(s)\r\n1>         Time elapsed 00:00:04.3222995\r\n1>\r\n1>       GetTypeScriptCopyToOutputDirectoryItems:\r\n1>         Adding items with BuildAction=TypeScriptCompile to the same collections that will be populated (with items of other BuildActions) by the GetCopyToOutputDirectoryItems target\r\n1>\r\n1>Build succeeded.\r\n1>\r\n1>Time Elapsed 00:00:06.89\r\n2>------ Build started: Project: My.Portal.Test, Configuration: Debug Any CPU ------\r\n2>Build started 7/1/2016 11:36:01 AM.\r\n2>     1>\r\n2>CoreCompile:\r\n2>         C:\\Program Files\\dotnet\\dotnet.exe build \"C:\\code\\MyPortalSolution\\tests\\My.Portal.Test\" --configuration Debug --no-dependencies\r\n2>     1>\r\n2>C:\\Program Files (x86)\\MSBuild\\Microsoft\\VisualStudio\\v14.0\\DotNet\\Microsoft.DotNet.Common.Targets(262,5): error : An item with the same key has already been added. Key: MyMVC\r\n2>\r\n2>Build FAILED.\r\n2>\r\n2>Time Elapsed 00:00:00.50\r\n========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========`\r\n\r\nMyMVC project.json\r\n`{\r\n  \"dependencies\": {\r\n    \"Microsoft.NETCore.App\": {\r\n      \"version\": \"1.0.0\",\r\n      \"type\": \"platform\"\r\n    },\r\n    \"MailKit\": \"1.3.0-rc1-1\",\r\n    \"Microsoft.ApplicationInsights.AspNetCore\": \"1.0.0\",\r\n    \"Microsoft.AspNetCore.Authentication.Cookies\": \"1.0.0\",\r\n    \"Microsoft.AspNetCore.Diagnostics\": \"1.0.0\",\r\n    \"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore\": \"1.0.0\",\r\n    \"Microsoft.AspNetCore.Identity.EntityFrameworkCore\": \"1.0.0\",\r\n    \"Microsoft.AspNetCore.Mvc\": \"1.0.0\",\r\n    \"Microsoft.AspNetCore.Razor.Tools\": {\r\n      \"version\": \"1.0.0-preview2-final\",\r\n      \"type\": \"build\"\r\n    },\r\n    \"Microsoft.AspNetCore.Server.IISIntegration\": \"1.0.0\",\r\n    \"Microsoft.AspNetCore.Server.Kestrel\": \"1.0.0\",\r\n    \"Microsoft.AspNetCore.StaticFiles\": \"1.0.0\",\r\n    \"Microsoft.EntityFrameworkCore.SqlServer\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Configuration.EnvironmentVariables\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Configuration.Json\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Configuration.UserSecrets\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Caching.Memory\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Logging\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Logging.Console\": \"1.0.0\",\r\n    \"Microsoft.Extensions.Logging.Debug\": \"1.0.0\",\r\n    \"Microsoft.VisualStudio.Web.BrowserLink.Loader\": \"14.0.0\"\r\n  },\r\n \"tools\": {\r\n    \"BundlerMinifier.Core\": \"2.0.238\",\r\n    \"Microsoft.AspNetCore.Razor.Tools\": \"1.0.0-preview2-final\",\r\n    \"Microsoft.AspNetCore.Server.IISIntegration.Tools\": \"1.0.0-preview2-final\"\r\n  },\r\n \"frameworks\": {\r\n  \"netcoreapp1.0\": {\r\n    \"imports\": [\r\n      \"dotnet5.6\",\r\n      \"portable-net45+win8\"\r\n    ]\r\n  }\r\n  },\r\n   \"buildOptions\": {\r\n    \"emitEntryPoint\": true,\r\n    \"preserveCompilationContext\": true,\r\n    \"xmlDoc\": false\r\n  },\r\n  \"runtimeOptions\": {\r\n    \"configProperties\": {\r\n      \"System.GC.Server\": true\r\n    }\r\n  },\r\n  \"publishOptions\": {\r\n    \"include\": [\r\n      \"wwwroot\",\r\n      \"Views\",\r\n      \"appsettings.json\",\r\n      \"web.config\"\r\n    ]\r\n  },\r\n  \"scripts\": {\r\n    \"prepublish\": [ \"npm install\", \"bower install\", \"gulp clean\", \"gulp min\" ],\r\n    \"postpublish\": [ \"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%\" ]\r\n  },\r\n  \"version\": \"1.0.0-*\"\r\n}`\r\n\r\n\r\nTest project.json\r\n`\r\n{\r\n  \"dependencies\": {\r\n    \"MyMVC\": \"*\",\r\n    \"Microsoft.EntityFrameworkCore.InMemory\": \"1.0.0\",\r\n    \"xunit\": \"2.2.0-*\",\r\n    \"xunit.runner.visualstudio\": \"2.2.0-*\",\r\n    \"dotnet-test-xunit\": \"2.2.0-*\",\r\n    \"System.Linq\": \"4.1.0\"\r\n  },\r\n  \"frameworks\": {\r\n    \"netcoreapp1.0\": {\r\n      \"dependencies\": {\r\n        \"Microsoft.NETCore.App\": {\r\n          \"type\": \"platform\",\r\n          \"version\": \"1.0.0\"\r\n        }\r\n      },\r\n      \"imports\": [\r\n        \"net46\"\r\n      ]\r\n    }\r\n  },\r\n  \"testRunner\": \"xunit\"\r\n}\r\n`\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"esargent"}}