c# missing namespace Windows - c#

Visual Studio 2015 Community can not resolve
using Windows.Networking.Connectivity;
I tried different types of c# projects and different .Nets 3.5-4.5

This namespace is only available for Universal Windows Platform (UWP). As you can see it here: https://msdn.microsoft.com/library/windows/apps/br207308

I understand this question is very old, but I would like to help people who have the same issue as me. Contrary to Nasreddine's answer, it IS possible to get the windows namespace on platforms other than UWP.
To get the windows namespace, you must first unload your project in whatever IDE you are using. After that, open your .csproj file in your text editor. You should see and opening and closing <PropertyGroup> somewhere in the file, inside of there paste in the following line: <TargetPlatformVersion>8.0</TargetPlatformVersion> Save the file, then (re)load your project in your IDE. Right click on Refrences, and click Add Refrences. There should be a new Windows Tab, and inside of that, Core. (This would not appear without doing the previous steps.) You may or may not have a refrence option inside of there named Windows, if you do check the box, and you can now use the Windows namespace, if not, fully close your IDE, and install the Windows 8 SDK from https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/, Once you have done that, start back up your IDE, and you should see the Windows namespace. If some some reason, you still do not see the namespace, click browse, and navigate to C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral\ and select Windows.winmd.
Additional information: https://software.intel.com/content/www/us/en/develop/articles/using-winrt-apis-from-desktop-applications.html

Just to update in 2021, you can gain access to this api (and others) with the Microsoft.Windows.SDK.Contracts nuget package. You'll still run into issues in .NET 5, but .Net Core 3.1 works fine.

Related

How to access Windows.Management.Deployment namespace in a Desktop project in VS2017?

Question: Where in Windows 10 we can find Windows.Management.Deployment.dll or how can we install it?
In a WinForm project in VS2017 - ver 15.9.6 I'm trying to follow C# example of PackageManager.FindUsers(String) method that uses classes from Windows.Management.Deployment namespace.
But can't seem to find the location of above dll that is needed to add a reference in VS2017 project. I installed UwpDestop NuGet package, also add a reference to windows.winmd file, but that did not help either. I'm using Windows 10 Pro- Update 1809.
In your Winforms project you need to go to "Add Reference …" and hit the "Browse" button. Then navigate here and select the Windows.winmd file that corresponds to the Windows SDK you are targeting. Be sure to change the file extension filter to .

cannot add cefsharp to wpf

I installed cefsharp using nuget
and followed the tutorial on the link below
https://www.codeproject.com/Articles/881315/Display-HTML-in-WPF-and-CefSharp-Tutorial-Part
but i can't make it work.
currently im using .net framework 4.5.2
i also build the program. i can also run the program, but it doesn't show the webbrowser.
i also add the namespace: xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
the screenshot of the error is below
This error only occurs when you have opened Visual Studio WPF designer (wiki CefSharp). When you run program everything will be ok.
it seems you didn't added referecnces to your project, first add references and then include them into your code.

No WPF User Control Library Template found in VS 2013

I am using VS 2013 (Express Version) and I want to create a WPF user Control Library project. But I am not able to find the template in my installed templates list. If I use Winforms, I am able to build a DLL out of my Winforms Application Project just by changing the Output type as "Class Library". But it is not happening in WPF and it is throwing errors if I do so. Is this the correct method of doing it or am I going wrong?
And in the Create New Project dialogue window, I am not able to find the .NET Framework selector drop down. After creating the project only I am able to change the .NET framework version by going inside the properties of the project.
Kindly help me to get out of this. Thanks in advance.
I have been working on this exact same problem for hours this morning. Here is what I think I have learned:
With Visual Studio Express 2013, it is by design that the WPF User Control Library template is not available for making a New Project. This is because it is the free Express version.
With the Express version, you don't have a "devenv.exe" for trying the "devenv /installvstemplates" to "fix" things. It is, instead, called (just a moment while I look this up again...) "WDExpress.exe" and will be located (if you have default location) in the "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE" directory. BUT - this won't help you. It won't fix your problem, because, as I mentioned, your Express installation is designed to not have that template available for New Project, so your "fix" won't put it there. I know this because this is what I tried myself. (Also, note that the instructions for doing this tell you to uninstall any extensions you've installed before doing it. And then, of course, if you still want them you have to reinstall them. Like I still have to do, incidentally.) I'm letting you know all of this so you don't go through the headache I'm having.
Note that I have not done this yet, so this is somewhat hypothetical on my part, but is based on my research on the Internet so far - Your solution is to create a WPF User Control Library manually [but now see UPDATE below]. (No, I don't know how to do this yet. I got into this in the first place, because I'm a WPF novice - just started working with it a few days ago - and late last night I got this great idea to add a "spinner" progress indicator to my "WPF play/learning project" I'm working on, and found a couple of relatively easy-to-work-with samples on the Internet - both of them are a WPF User Control Library - and at first I wanted to use the copy-and-paste to put the code in. But then I discovered... well, our mutual problem, because I'm using Visual Studio Express 2013. No such template under New Project. And literally at the tail end of my about-to-throw-in-the-towel, I'm googling and your post, Dhivakar, is already showing up with the right Google search.) So I haven't finished my research yet, but my next step is to learn exactly how to create a WPF User Control Library manually (the code and various project property settings), and then I can just save a WPF User Control Library skeleton for future use and document the details.
UPDATE: This guy totally has the solution for Express versions. I have followed his steps and it works great. The only additional piece of information I would add is that in my version (VSE2013), after you've created your WPF User Control Library template, when you open Visual Studio again and use File -> New Project, my selection in the tree (for a Windows app) came up under Templates -> Visual C# -> Windows (which is what I've been using). I did not see my template showing up there, after I created it, and I thought, "Great! Another piece of advice that doesn't work." But then I clicked up one on the "Visual C#" parent - and there was the template!
Here you go:
How to add a WPF control library template to Visual C# Express 2008
https://dotupdate.wordpress.com/2007/12/05/how-to-add-a-wpf-control-library-template-to-visual-c-express-2008/
Yes, it works this way for VSE2013 too.
UPDATE 2: I'm not absolutely positive about this, but I think he missed one little piece. In his step #4 he says to delete Window1.xaml and App.xaml. Maybe this didn't apply with VSE 2008, but in VSE 2013 there is also the App.config file which I believe is extraneous for our purpose. So you can delete App.config as well. As I said, I'm not absolutely certain about this yet, but I noticed that file in the project when I added a WPF User Control Library project to my solution, and I deleted it, and the solution compiled okay.
Try running devenv with the /installvstemplates switch, from https://msdn.microsoft.com/en-us/library/vstudio/ms247116(v=vs.100).aspx
If this doesn't work, browse to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplatesCache\CSharp\WPF\1033\WPFUserControl (this could change dependent upon your installation directory), open the .vstemplate file in a text editor, and make sure the setting is set to true, then try running devenv with the switch again.
Hope it helps.

One or more project was not loaded properly

After copying the project to another laptop/ PC, when I want to open the solution, VS2010 shows the error "One or more project was not loaded properly". I have tried running visual studio in admin mode but that did not solve the problem.
This is usually a result of an inconsistency in your solution or projects. Open the solution file in an external editor (such as notepad) and check that the path it has to the projects is available and did not change. There shouldn't be any absolute paths in the solution file.
Maybe because the project from where you copied was configured with IIS configurations and you are trying to run the project in visual studio's default environment.
you have to right click on your project and set as a start up project after that you have run your project,
I seem to have found unloaded project, after noticing there's one missing by manually counting and comparing it to the number of projects the solution explorer reported. It was deep inside another folder in the solution explorer that I never used and assumed that had nothing worthwhile.
It's a familiar issue. Looks like the project you are trying to open was created in higher version than what you have. If the project is in MVC, make sure you have installed MVC OR Make sure you have appropriate version of .NET installed in your system.
I work with NopCommerce and a couple of times I downloaded new version and got same error message. It goes away once I install the dependencies.
Because you tagged it ASP.NET make sure you have all the ASP.NET components installed. Those are not part of .net framework but might be necessary in your project.

Not Seeing SlimDX in "Add Reference" Visual Studio 2012 tab

I'm trying to get SlimDX up and I'm following their tutorial here. Under project settings it shows how to add a reference to SlimDX but when I follow they're steps I don't have SlimDX in my options. I've tried reinstalling the SDK a few times and it hasn't helped. I'm pretty new to C# and Visual Studio so excuse me if it's a small user error.
The newer installations don't add SlimDX to the GAC, so it doesn't show up in the reference windows.
You should be able to browse to their installation folder, and pick the assembly directly. This will add the reference, and copy it locally on build (by default).
For those who look for the direct directory (obviously only after installation).
That's for the .Net v4 (from: https://slimdx.org/download.php)
C:\Windows\Microsoft.NET\assembly\GAC_32\SlimDX
or:
C:\Windows\Microsoft.NET\assembly\GAC_64\SlimDX
I looked for That for the last hour++

Categories