I'm using VS 2012 and I need to write code that uses the classes in the Windows.Devices.Gelocation namespace. I downloaded the sample program but it won't load in VS2012 as it requires VS 2013. And the documentation for the class does not indicate which DLL that namespace is in.
Can someone tell me which DLL contains that namespace? Is it available in .NET 4 or do I have to use .NET 4.5?
Edit
My project is a console application which runs in the background as a Windows service. The searching I've done indicates that I have to target Windows 8 by using the Reference Manager's Windows Tab. But there is no Windows tab in the Reference Manager in my project because it's not a Windows Store application. Is there a way to use this API from a desktop application???
I've found how to reference the assembly I need.
On this page, under the section Windows Tab, in the Core Subgroup subsection, the third paragraph gives instructions on how to reference the needed windows assemblies from desktop applications. To summarize it:
Unload the project to which the reference will be added.
Edit the .csproj file for the project.
Add the following snippet anywhere in the .csproj file:
<PropertyGroup>
<TargetPlatformVersion>8.0</TargetPlatformVersion>
</PropertyGroup>
Save the edited .csproj file.
Reload the project.
At this point, when you open the Reference Manager dialog, you'll see a Windows tab on the left. Click that, and you'll see the Core subgroup. To the right, it'll say "Targeting Window 8.0" and under that "Windows version 255.255.255.255" will be unchecked. Check it off then click OK & you're done.
Related
I have an existing solution for a UWP Windows Store app, and I recently needed to add Win32 desktop app capabilities to it. I reviewed the Microsoft documentation for adding a full trust executable and followed the example here: https://stefanwick.com/2018/04/06/uwp-with-desktop-extension-part-1/
After adding the Windows Application Packaging Project and adding my UWP app project as the entry point, I get this error while building:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4643,5): error MSB3030: Could not copy the file "C:\path\to\UWP\project\bin\x86\Debug\WinMetadata\Windows.winmd" because it was not found.
I notice that WinMetadata\Windows.winmd is normally included in the AppX folder when packaging the UWP app by itself, but it usually does not appear in the base bin\x86\Debug folder. If I remove almost all of the C# code referenced in my project, I am able to build and run the app.
Why would the Windows Application Packaging project be looking for this file in <UWP_Project>\bin\x86\Debug?
UPDATE:
If I create a new blank UWP project and add it as a reference to the WAP project instead, I can confirm it builds fine. But if I then add in my other dependencies, nugets, and project references containing my UWP app's code, I get the behavior I described.
Most of the app's C# code is contained in shared projects (for portability). These shared projects only contain C# code. If I do the above steps, reproduce the error (missing WinMetadata\Windows.winmd) and then remove these shared project references containing the code (leaving all Nugets and other dependencies), it builds again! Obviously I need the code as part of the app..
I assume this file (WinMetadata\Windows.winmd) is added by default for UWP apps, so is there a particular thing I should be looking for, maybe in the build log, to see why this file would not be copied into that location?
I have created a Visual C# Console App and I am trying to add reference to resolve an error. Since I am new to the IDE and I am looking for some help on how to add the Reference via the editor. I am trying to connect to Azure Storage via this app.
Attaching the screen shot.
I used the general resolution saying
In Solution Explorer, double-click the My Project node for the
project.
In the Project Designer, click the References tab.
But I am not seeing the References tab to add Reference.
Thanks for help. First place I was supposed to create a 'Console App (.Net Framework' instead I mistakenly chose Console App (.NET Core). Now I am ble to see the Refrences.
Thanks for the help.
First of all switch the Solution Explorer view by clicking button in the header as shown in the below image:
After that you will find the "References" node in the tree. Right click and then choose Add Reference
References:
Managing references in a project
How to: Add or Remove References By Using the Add Reference Dialog Box
If you want to use .NET Core (.NET) instead of .NET Framework, just install this package in PM:
PM> Install-Package System.Configuration.ConfigurationManager -Version <YourCompatibleVersion>
Currently I am trying to add service reference for mine Portable Class Library (PLC) in my Xamarin.Forms apps. For that point, I read that I have to remove Windows Phone 8.1 target platform.
I am opening PLC properties and I see where the target platforms are, there I find WinPhone and Silverlight, unfortunately when I click Change they disappear and I cannot remove them.
Screenshot of libraries
Can anybody suggest what the issue could be and how can I fix it?
Please keep in mind that I am doing it with Visual Studio Community 2017 (version 15.2).
Thanks in advance
1 option is to change the .net profile version manually in your .csproj file.
Visual Studio unload your current PCL Project.
Edit your .csproj File (Right Click on the unloaded project)
Find Node <TargetFrameworkProfile></TargetFrameworkProfile>
Change Value to Profile7
Save and close the file.
And than reload your .csproj file.
Another way is to uncheck Asp.Net Core when clicking on Change button. That will give you the Add ServiceReference instantly.
I need to use Windows.Storage.Streams and Windows.Devices.Enumeration in my Winforms application on Windows 7 to access and manipulate Barcode reader, but unable to find it to Add Reference. Not sure if can download it somewhere. I was able to find and download Microsoft.PointOfService and added reference to my project, but not the first two libraries.
Please advise.
The Windows.Storage.Streams and Windows.Devices.Enumeration namespaces are part of the Windows Runtime. To use them you need to target Windows 8 or above. They aren't available when targeting Windows 7.
How to access the Windows 10 APIs from WPF
You can access the Windows 10 APIs from a pre-existing WPF project. To do so, go to your Solution Explorer window and …
Right click on References.
Select “Add Reference…” from the context menu.
On the left of the Reference Manager, choose Browse and find the following file: C:/Program Files (x86)/Windows Kits/10/UnionMetadata/Windows.winmd.
Add it to your project as a reference. Note: You will need to change the filter to “All Files”.
Right click on References. Select “Add Reference…” from the context menu. On the left of the Reference Manager, go to Browse and find the directory “C:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETCore/v4.5”. Add System.Runtime.WindowsRuntime.dll to your project.
Learn More Calling Windows 10 APIs From a Desktop Application
Just to be helpful to others that arrive here through Google, Microsoft has some NuGet packages to access Windows-specific APIs like that without the need to import or reference Windows libs manually. More info can be seen on their documentation here.
For those trying to use it from Windows 8/8.1, add a reference (like Sajeeb's answer) to the files at 32-bit C:\Windows\System32\WinMetadata or 64-bit C:\Windows\System32\WinMetadata respectively.
I believe those namespaces are not part of Windows Apps libraries. I don't think a WinForm project is able to use them. Personally, I don't have newer versions of VS, so I am not sure of that. But there is supposed to be a new project type in VS2015 onwards.
This is my first time trying to use a dll file in visual studio (2012) so I am not sure what I am doing wrong. I am trying to get sqlite into my project following this tutorial
I right click on the project in the Solution Explorer and click Add References
I then click on the browse tab and find where I have the dll file,click ok then ok in visual studio and I get an error saying Reference to *dll path* could not be added. Please make sure the file is accessible and that is it a valid assembly or COM component.
did I miss a step here or something?
The file is located in my dropbox folder (where my whole project is) and the project is a windows store application is that matters
Not a direct answer but instead of referencing the dll directly, you should install the Visual Studio extension for SQLite. The extension includes the dlls for all platforms (x86, x64, ARM). It also makes sure that the right dll is used for the platform that you are building for.
After you install the extension, it will appear in the references dialog under Windows -> Extensions. Also, when you use the extension, you must change all your project build configurations to be x86 or x64 (on the desktop) or Arm (for Arm devices). It will fail to build if you use AnyCPU.