-1

Short backstory, I need to create an App for my computing coursework, and since I'm quite the procrastinator I wanted to make an app that shuts down processes that users waste time on.

Therefore I looked up how to make Windows 10 apps and stumbled across Microsoft's own "C# Fundamentals for Absolute Beginners" and "Windows 10 Development" for absolute beginners. I spent over 20 hours watching these videos over the past few weeks.

Now I have designed nearly all the UI in XAML over the past few days and now when working on the Code behind in c# I noticed that System.Diagnostics.Process could not be found, I tried to work out why and eventually stumbled across this answer which made my jaw drop (TLDR it's because it's a UWP app): Missing reference to System.Diagnostics.Process

I do not need my app to run on the Windows Store, all it needs to run on is my computer however messy the solution may be, but I really need access to that class to shutdown processes. I really want to make the app in C# and XAML though and I'm not sure if I can do this whilst having access to the System.Diagnostics.Process class.

I am really running out of time for this project and I can't just change my idea as the problem definition essay has already been marked, etc and that would take forever to rewrite.

I am open to the idea of just writing the application fully in C# if there's really no way I can use XAML without making a UWP app. But I'm not sure what's the easiest way of doing this/what project type so any help would be appreciated.

I feel very angry at Microsoft for not making it clear that "Windows 10 Development for absolute beginners is" actually "Windows Store Development for absolute beginners". I do not want my app on the Windows Store so if I could force reference the process class that would be great!

Community
  • 1
  • 1
  • 4
    wpf, but that has a different set of elements. – Daniel A. White Jan 03 '16 at 16:55
  • You might need to reference the appropriate assembly? https://msdn.microsoft.com/en-us/library/wkze6zky.aspx As well, you can search for other examples about that namespace http://www.dotnetperls.com/process –  Jan 03 '16 at 17:03
  • I'm not a Windows dev, but [this looks like a fruitful search](https://duckduckgo.com/?q=windows+10+kill+application+console). If you don't have the capacity to kill an app in your chosen environment, can you run a console utility? You should be able to kill a process from there. – halfer Jan 03 '16 at 17:12
  • 1
    You want a Windows Desktop app. You can probably use most of the same XAML. – Jeff Jan 03 '16 at 17:16
  • Can't use the Console class either in UWP! –  Jan 03 '16 at 17:18
  • He doesn't mean Console, he means shell out but you can't do that without Process. – Jeff Jan 03 '16 at 17:19
  • It won't let me reference System.dll as it's already reference which is where System.Diagnostics.Process is located –  Jan 03 '16 at 17:20
  • 5
    To the OP: that's because UWP apps have no idea of the system they run on. System.dll is a full Windows DLL, and UWP apps cannot reference the full .NET Framework. Look up WPF in Google, it's what suits you best without doubt. – Camilo Terevinto Jan 03 '16 at 17:30
  • Thanks guys, I have begun porting my app to WPF. Stuff like RelativePanel and SplitView isn't included but I downloaded a ported version so it's all good. My app isn't very pretty now though, oh well! –  Jan 03 '16 at 18:55

1 Answers1

6

You need to develop a Desktop app (WPF). With WPF you also use C# and XAML, however you can use all .Net Framework.

UWP (Store apps) need to run in devices like Surface RT (Windows RT), Lumia 920 (Windows 10 Mobile), XBOX and Hololens so they use only a part of the full .Net Framework (they use the .Net Core Framework). UWPs run in a sandboxing so they usually don't have access to system APIs (low level access like create a IP package). In this case you should use WPF.

Your problem is one of the reason, I think that StackOverflow use the tag uwps and win-universal-app.

ganchito55
  • 3,559
  • 4
  • 25
  • 46