Visual Studio 2015, Nuget and “same key has already been added.” - c#

I have Visual Studio 2015 RC. When I open a console app or a Windows Phone 8 Silverlight project, everything works fine, I can use Nuget without problems.
When I open a Universal App project (Windows 8.1 + Windows Phone 8.1), Nuget breaks. When I open the Nuget console, I see
When I try to install a Nuget package using the Nuget GUI, I get the same error.
One more strange thing. When I open VS2015 RC without any projects and open the Nuget console, I do not get the error. Then when I open my Universal App project, the error appears.
I am pretty sure it is connected to the Universal App project.
I testes the Universal App project in VS2013 and everything works fine there, no problems with Nuget.
I tried all the steps in installing nuget package "same key has already been added." but it did not help. I guess it is because another folder may be corrupted in my case.
Happens to me on two separate machines, both run Windows 8.1 Pro, one has only VS2015 RC and on has both VS2013 Pro and VS2015 Pro.

I have had the same problem with VS2013 from time to time. While I don't have the exact steps to resolve here, the following summarizes what worked (it may be over kill).
use the package manager to remove all packages
remove the library binding section in the app config
re-add the packages via the package manager
It is a windows machine, you may need to restart visual studio between each step.

Related

visual studio does not recognize windows 10 sdk in version 10.0.14393.0

my Visual Studio does not recognize my Windows 10 SDK.
The steps to reproduce it:
Install VS 2015 Professional with update 3 and select the windows SDK for version 10.0.14393.0 as optional feature
Create an UWP App with this version
The following error is displayed in the output window:
error : The project requires a platform SDK (UAP, Version=10.0.14393.0) that is not installed. Please visit the following link for more information: http://go.microsoft.com/fwlink/?prd=12514&pver=14.0&sbp=PlatformSDKMissing&plcid=0x409&o1=UAP,%20Version=10.0.14393.0
Uninstall Windows 10 SDK 10.0.14393.0
Install Windows 10 SDK 10.0.14393.0 from the link provided in step 3
Create an UWP App with the version 10.0.14393.0 and the same error like in step 3 is displayed
further information: in the list of programs and features in the control panel the name of the sdk is:
Windows Software Development Kit - Windows 10.0.14393.795
and the version is
10.1.14393.795
My guess is that the version is wrong in the registry and therefore visual studio cannot find the sdk.
If I look under the path C:\Program Files (x86)\Windows Kits\10\Platforms\UAP I can see a directory named 10.0.14393.0 that contains a Platform.xml and a PreviousPlatforms.xml as it should.
Under the path C:\Program Files (x86)\Windows Kits\10\bin there is a directory named 10.0.14393.0 too so the SDK seems to be installed correctly
I already tried reinstalling of visual studio and several SKDs in different versions from VS or the online link and nothing worked. If I target another SDK Version like 10.0.10586 I am able to create the project.
Thank you for reading. I am thankful for every hint into the right direction.
Reinstalling Windows is not necessary. Modify the existing installation of VS2017 and remove the check next to Universal Windows Platform development, then go to the Individual components tab and select the Windows SDK 10.0.14393.
Click Modify.
Once finished, Modify the existing installation of VS2017 again and recheck the Universal Windows Platform development box and Click Modify.
Problem resolved and no restart required.
I had this same issue but resolved it by installing the .033 version rather than the latest .795. It is available on the SDK download page in the description of the SDK by clicking on the link behind 'QFE':
Windows 10 SDK (ver. 10.0.14393.795 – a QFE for 10.01.14393.033) and Microsoft Emulator for Windows 10 mobile
Also, even though it wasn't required, I uninstalled .795, then rebooted. Then installed .033 and then rebooted again prior to trying to open visual studio.
I'v already installed Windows SDK 10.0.14393.795 successfully. Then I create UWP project which targets 14393 successfully. So I could not reproduce your issue.
I already tried reinstalling of visual studio and several SKDs in different versions from VS or the online link and nothing worked.
If you have tried to repair your visual studio, but it still didn't work. You'd better use  http://aka.ms/vscollect to gather the installation logs. Find vslogs.zip from %temp% folder. Please upload the file and share the link here. I will help you find the root cause according to the log file.
The solution is to reinstall windows and make a clean install of Visual Studio. Somehow the system got messed up and not even a visual studio reinstall could help.

Q: Does VS2015 Community Update 3 compile Windows UWP Apps for Win10 Build 10586 on Win7SP1?

I have a PC with Windows 7 SP1 (64bit) that I have been using to build a Windows store app. I've been using Visual Studio 2015 Community Edition Update 2. This worked great until I applied Visual Studio Update 3 and the latest Windows SDK (14393).
When I target the previous release (10586), I get the following error when I try to compile a C# project:
Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(2151,5): error APPX0002: Task 'GenerateAppxPackageRecipe' failed. 0x7F - Failed to load MRM support library.
(I have a C++ UWP project in the same solution and it compiles into a DLL without any issues.)
I've tried reinstalling VS2015 Update 2, reinstalling VS2015 Update 3, repairing Visual Studio, repairing the Windows SDK for 10586. None of these worked.
I know the latest Windows 10 SDK does not support Windows 7 SP1; however, does this apply to all previous Windows 10 SDK's?
Finally, after days of repairing and re-installing, I finally fixed this.
Step 1: Assuming you installed Visual Studio in the default location, goto the following folder: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage
Step 2: Rename Microsoft.AppxPackage.Targets to something else. I added "-old" after Package.
Step 3: Clean the solution.
Step 4: Confirm you are targeting Windows 10 Build 10586.
Step 5: Build the solution.
My targets file is dated May 31, 2016 before I even installed Visual Studio 2015. Before I did these steps, I also deleted everything in the bin/Debug folder but I'm not sure if this helped or not.
Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(2151,5): error APPX0002: Task 'GenerateAppxPackageRecipe' failed. 0x7F - Failed to load MRM support library.
This is a known issue in Windows 10 SDK (ver. 10.0.14393.33) which is included in Visual Studio 2015 with Update 3. And it has been fixed in QFE Build 10.0.14393.795.
This non-security update includes quality improvements:
Addressed issue where developers could not build UWP apps on Windows 7 because MRMSupport.dll failed to load.
Addressed issue where MidlRT and MDMerge failed to run on Windows 7
Addressed issue where SDK setup failed to install on Windows
Addressed issue where deploying a legacy Store app to a 8.1 Phone caused Visual Studio to crash
Addressed issue where application data was not preserved across remote debugging sessions when apps were getting un-registered
For more info, please see Windows SDK and emulator archive.
To solve this problem, please go to Add/Remove Programs and Uninstall Windows Software Development Kit - Windows 10.0.14393.33. Then reinstall the 10.0.14393.795 version from Windows SDK and emulator archive. After this, you should be able to build the UWP app with no error.
However, on Windows 7, with Visual Studio 2015, the official support for Windows Universal is "Build only". A lot of other Visual Studio features are degraded. So if you are developing Windows Universal Apps, Windows 10 is strongly recommended. For more info, please see this answer.

Failed to add reference. User canceled out of save dialog (OLE_E_PROMPSAVECANCELLED)

I cannot add a solution reference to a portable class library to my Windows Phone 8.0 apps in Visual Studio 2012. When I try to add it by browsing to the .DLL, then it works. I receive this error when I try:
I am able to add a reference to the portable class library in my web service project, so the library itself appears to be OK.
I have tried:
Restarting Visual Studio.
Restarting Windows
Creating a new Windows Phone project
Creating a new portable class library
Repairing the Windows Phone 8 SDK
Repairing Visual Studio 2012
Regardless of what combination of those things I have tried, attempting to add a solution reference to a portable class library in a Windows Phone project gives me that error.
Well, it turns out that this error message was actually completely useless in what the issue actually was.
The issue was caused by a version mismatch between the PCL and Windows Phone project. I finally realized that VS 2012 only lets you target Windows Phone 8.0
for phone apps, and not 8.1, and I was selecting Windows Phone 8.1 as one of the target frameworks in my PCL. In order to allow me to add a solution reference to the PCL, I had to add "Windows Phone Silverlight 8.0" as one of the target frameworks. Now it works fine.
I have no idea why that error message is the one that I was receiving, but hopefully this can help someone else out if they run into it.
Problem in my case
I am not able to install Microsoft.EntityFrameworkCore.Tools package.
Every time I run the command inside Package Console it shows an error like this
Error
User canceled out of save dialog (Exception from HRESULT: 0x8004000C)
Solution
Restart Visual studio 2019 in admin mode.
Please make sure your project file is not locked.
You can check it by trying to edit the project file (.csproj file). If this file is locked, you cannot add the dependencies.
Tell the person who locked the file to check in or undo the project file and then try to add the dependency
Make sure you have saved any files that you have been working on before attempting this operation. I went to restart Visual Studio and it informed me that I had some pending saves. I saved, restarted and then was able to add the project reference.
Close the Visual Studio and open in run as Administrator .Then try to install the packages.I hope this will work.

Windows Universal App, could not add all required packages to project

So with the release of Windows 10, I've now installed it along with Visual Studio Community 2015 with the plan of developing new Windows Universal Apps...
However, when I try to create a blank Universal App, this error occurs while creating the project:
https://i.gyazo.com/4199572c66648138c17f2fc2921c6fcd.png
(Sorry, can't post images).
Followed by these errors in the error output:
https://i.gyazo.com/3685ae972899ee7dbf9fafdd697d6f7f.png
I haven't done anything to the code. This is from a fresh install of Community 2015 and a blank project, based on the Universal App Templates for C#
I've tried reinstalling Visual Studio and repairing, but no luck.
You have to save your project and then install UniversalWindowsPlatform with nugget package or type :
Install-Package Microsoft.NETCore.UniversalWindowsPlatform
In the Package Manager Console
Then, you can compile and launch your program.
For me, I was trying to add a new project to an existing solution. I got the same error and also tried repairing VS, checking and unchecking "Save new projects...", as well as trying to install the dependency manually. What got it to work for me was adding
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
}
to the newly-created project.json file.

I've installed SQLite in Visual Studio 2013 using NuGet but the package never appears in References

I'm running Visual Studio Ultimate 2013 on Windows 8.1. I've started a new C# project with the intent of using SQLite in it. However, I'm running into problems. In the Solution Explorer window I right clicked on my project name which looks like this:
MyProj (Windows 8.1)
and selected "Manage NuGet Packages". At that point I searched for "sqlite" under Online/All and installed this package:
System.Data.SQLite (x86/x64) Version 1.0.96.0
So far so good. I got no errors and the package shows up under my "Installed packages" section. However, when I look in the Solution Explorer under References, I don't see it.
Furthermore, when I type:
using System.Data.SQLite;
into my code, I get an error saying that it can't resolve it. So, what am I doing wrong here?
I had a similar problem using the Azure Mobile Services demo.
When I started working on the offline tutorial , Visual Studio showed the reference for Sqlite for Windows Runtime (Windows 8.1) as missing.
I was able to download the library from the Visual Studio Gallery (https://visualstudiogallery.msdn.microsoft.com/1d04f82f-2fe9-4727-a2f9-a2db127ddc9a) and then I was able to manually add the reference
Ok, here was the link I needed: https://msdn.microsoft.com/en-us/library/windows/apps/dn263243.aspx
Thanks for your help.

Categories