问题
I tried to add a Reference to Bing Maps in my app by right-clicking on References | Add References | Windows | Extensions | Bing Maps for C#..., but selecting "OK" does nothing - the Reference is not added.
I then tried adding it via Tools | Extensions and Updates, but when I installed the latest version (with today's date - 11/5/2012), I then got:
Successfully installed 'BingMapAppSDK 1.0.1011.1716'.
Successfully uninstalled 'BingMapAppSDK 1.0.1011.1716'.
Install failed. Rolling back...
Could not install package 'BingMapAppSDK 1.0.1011.1716'. You are trying to install this package into a project that targets '.NETCore,Version=v4.5', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.
Now the button there (at Tools | Extensions and Updates | Bing Maps SDK for C#... says "Uninstall" so it is apparently installed, but why can I not add the Reference to my project?
UPDATE
It's not just Bing Maps that won't let itself be added to my project's References; when I try to add "Microsoft Visual C++ Runtime Package," it also will not be added; there's no err msg when I select it, it simply doesn't get added...
I have another project which has "Bing Maps for C#..." installed as a Reference. Why that one would work and the other one not is both a conundrum and an irritation.
The bizarre thing is that, according to Extensions and Updates Installed | SDKs, in the working project the only Bing Maps SDK installed is the one for JavaScript... and yet my project does have a Reference to "Bing Maps for CE, C++, or VB"...???
Yet if I go to Extensions and Updates | Online | Visual Studio Gallery and search for "bing maps" the search results contains "Bing Maps SDK for Windows Store apps" with a green check, indicating it is installed.
Could it be my project's configuration? The project that works is set for Debug, x86. The one that doesn't work is set to Debug, Any CPU...???
And if I'm doing something wrong, why is the "Filtered to: SDKs applicable to displaying (among other things) "Bing Maps for C#, C++, or VB"?
IOW, it's teasing me that it's available, but won't allow it to be added...argghhhh!!!
UPDATE 2
Maybe this could be a clue to my problem: In Tools | Extensions and Updates, Bing Maps SDK for Windows Store apps appears in the "Tools" category as opposed to the SKDKs category (although Bing Maps SDK for JavaScript) is in the SDKs category...
UPDATE 3
Based on Mayank's suggestion, I tried to browse to and add the .dll
That not only didn't work, but also gave me an err msg:
"A reference to C:\Users\Clay\AppData\Local\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Bing.Maps.Xaml\1.0\DesignTime\CommonConfiguration\x86\Bing.Maps.Design.dll' could not be added. The project targets '.NETCore' while the file reference targets .NETFramework'. This is not a supported scenario.
If this is truly the problem, how do I switch from .NETCore to .NETFramework? I'm certain I did not explicitly choose .NETCore at any time for this project...
UPDATE 4
Elsewhere somebody suggested I compare the .csproj files of an app that does work with the Bing Maps and the one that doesn't. Here's is what I have come up with:
I noticed that the app that IS working with Bing Maps has this in the .csproj file, whereas the other one doesn't:
<Compile Include="DataModel\SampleDataSource.cs" />
<Compile Include="Common\BindableBase.cs" />
<Compile Include="Common\BooleanToVisibilityConverter.cs" />
<Compile Include="Common\BooleanNegationConverter.cs" />
<Compile Include="Common\LayoutAwarePage.cs" />
<Compile Include="Common\RichTextColumns.cs" />
<Compile Include="Common\SuspensionManager.cs" />
<Compile Include="SQLite.cs" />
<Compile Include="SQLiteAsync.cs" />
<Compile Include="ViewModel\StorageUtils.cs" />
<Compile Include="View\SectionN.xaml.cs">
<DependentUpon>SectionN.xaml</DependentUpon>
</Compile>
...although curious (why does one include all of those files, and the other doesn't?), I don't see why this would be a problem.
Also, the working app contains this:
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'TSLsARM|
AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\TSLsARM\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
. . .
UPDATE 5
This is in response to JuStDaN:
Both solutions (the one that has the Bing Maps for Windows Store apps
reference, and the one that won't accept it) references the ".NET for
Windows Store apps" SDK, with these property settings:
Identity = .NETCore,Version=v4.5;
Version=4.5.0.0;
Path=C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\
Both have Application.Target framework=blank; Output: Windows Store app Application.Build.Configuration=Active (Debug); Platform: Active (x86)
I have at least a couple of other solutions that won't accept new references, either. It's as if the Bing Maps for Windows Store reference installed once, and then refused to ever again...
回答1:
you need to install
Bing Maps SDK for Windows Store Apps
Search in Tools>Extension and Updates>Online>
Update
I only got error when I selected Any Cpu
.
回答2:
Have you checked the library type in the project settings to make sure it is not based on the 'Client Profile' framework type instead of the full framework. I've had errors like this with references and this ended up being the culprit.
回答3:
Based on the error message you received: 'You are trying to install this package into a project that targets '.NETCore,Version=v4.5', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.'
It appears your project is in .net 4.5 and the particular SDK you are installing is not compatible with 4.5. Either get an SDK that is compatible, or change your project build to the appropriate supported version (I'd hazard a guess and say 4.0).
回答4:
I got "The system cannot find the reference specified" when referencing Bing Maps SDK under Any CPU.
Changed target CPU to x86 and it worked.
回答5:
One must check the checkbox.
So obvious, yet "invisible" to me - it seemed selecting the item should have been enough, and I paid no attention to/didn't "see" the checkbox. Perhaps one shouldn't be allowed to select "OK" with nothing selected/checked? And a hint telling you to check a checkbox?
Here's the answer:
http://social.msdn.microsoft.com/Forums/en-US/toolsforwinapps/thread/075ba866-fd8b-41d3-ab5e-a3c0812ab430
来源:https://stackoverflow.com/questions/13239597/why-can-i-not-reference-bing-maps-in-my-app