somehow (I have not even done anything) I get many erros in Visual Studio 2015 but I cant understand what the problem really is.
It says that a lot of "types" exists in both "Windows.Foundation.UniversalApiContract" libraries.
Can somebody help me? What can I do to rescue my solution and my project? I've tried to clean and rebuild it sometimes and this doesn't helped.
I ran into something similar:
Not fun. I think it started when I accidentally added an extension method to a set of utilities I keep in a Portable Class Library project that referenced
using Windows.ApplicationModel.DataTransfer;
, as I'd (stupidly) added some code that accessed the clipboard to the PCL. And that makes some sense; now I'm effectively targeting two Windows platforms, which is obviously wrong.A few things got added to that PCL project's csproj file. First was this line:
The second was this ItemGroup:
I'm not sure if all this was required, but I did remove the clipboard-related code, the reference to
Windows.ApplicationModel.DataTransfer;
in myusing
s, and reset/removed the changes to the csproj file.I still had many of the same errors, however. I've found that doing clean rebuilds doesn't always work as I'd expect, so I've created a .bat file that I keep in the root of the start-up project's folder to run when I have trouble. First I have to close the solution in Visual Studio, and then I run...
I now also have to run that (again, with the solution closed) before building and submitting to the store. Not real sure why but doing both of these -- removing non-PCL code from & resetting the PCL project and blasting those
/bin
and/obj
folders -- did fix the issue.My unscientific hunch for why I have to blow away
/bin
and/obj
is that VS doesn't always seem to build my projects in dependency order, and often references older compilations of my code when it should've started fresh. Blasting away any possible dated crutch seems to force it into doing things The Right Way. ¯\_(ツ)_/¯Looks like you are referencing both the Windows 10 SDK metadata (UAP) and the Windows 8.1 SDK metadata (Windows). Are you mixing old and new binaries, or an old project file? Try to create a new project from scratch and added your sources.