Questions tagged [c#]
C# is a programming language. Questions about programming are off topic. Please direct these questions to Stack Overflow.
338
questions
101
votes
12
answers
100k
views
How to make CTRL + / toggle a comment in Visual Studio
How can I make CTRL + / toggle a comment in Visual Studio, as it does with XCode and Eclipse?
50
votes
3
answers
88k
views
How can I compile a .NET project without having Visual Studio installed?
I want to compile a .NET/C# project, but I don't want to install Visual Studio to do this.
What tools do I need and how can I compile the project?
30
votes
2
answers
20k
views
When you start multiple threads on a multi core processor, are they guaranteed to be processed by different cores?
I have a Pentium core i5 processor, which has 4 cores. If I do this in a C# console program
var t1 = new Thread(Thread1);
var t2 = new Thread(Thread2);
t1.Start();
t2.Start();
are t1 and t2 threads ...
30
votes
5
answers
60k
views
How do I add formatted code to a Microsoft Word document?
I need to write a document in MS-Word 2007 that contains a lot of examples of VB.NET and C# code.
What is the best way of getting the code to look reasonable in the document?
What styles etc do ...
23
votes
1
answer
34k
views
What is .NET Multi-Targeting Pack?
Installing Visual Studio installs a bunch of .Net packages called
.NET x Targeting Pack
.NET x Multi-Targeting Pack
.NET x Multi-Targeting Pack (ENU)
Where "x" stands for the .Net version number it ...
19
votes
8
answers
16k
views
Why install for "just me" as opposed to "everybody"?
I'm using windows installer for a client's app, and they are complaining that sometimes multiple instances of an app appear on the computers they are using for testing. This problem has gone away ...
15
votes
5
answers
164k
views
How to use PSCP to copy file from Unix machine to Windows machine where target path has spaces?
I am having a problem using PSCP in a C# program to copy a file from a Unix machine to a Windows machine. The problem only happens when the target folder on the Windows machine has a space in it. ...
14
votes
3
answers
95k
views
How to show currently mapped drives in PowerShell?
Need a PowerShell command to display drive letter and path it is mapped to.
In other words a command that shows me the same thing Windows Explorer would.
Tried this:
Get-WmiObject -Class ...
13
votes
1
answer
72k
views
File does not contain a valid CIL image [closed]
I installed mono on my Suse 12.1. When I create a file, say hello.cs, and run mono hello.cs on the terminal, I get this error:
Cannot open assembly 'hello.cs': File does not contain a valid CIL image.
...
9
votes
1
answer
3k
views
Meaning of \b in .Net Regular Expressions [closed]
Microsoft has a nifty quick reference card for .Net Regular Expressions.
But it seems to list \b as both matching Backspace and also matching "On word boundary".
Which is it? Can \b really do both? ...
8
votes
2
answers
29k
views
Command line RDP call CMD on target machine
I need to remote into ~50 machines and run a batch file. Is there any way I can start up an RDP session and call cmd?
8
votes
4
answers
4k
views
How often do users change their IP address (average time needed)?
Basically, i need to know how long (on average) and ip address is used per user, this can be US-only stats or World-Wide stats, if you have a source please state it. If its your own data please let us ...
8
votes
7
answers
18k
views
How to launch the Windows Explorer shell after starting with a different one?
The following is a hack, but for what I need it for its fine.
I created a C# program that shows some EULA text and has an Agree and Disagree button.
I set the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\...
7
votes
4
answers
25k
views
Where is the MachineKeys folder in Windows 7?
I know where the MachineKeys folder in XP. Anybody can tell me where it is in Windows 7?
7
votes
1
answer
6k
views
TrueCrypt drive letter not available
With c# or a batch file I mount a trueCrypt volume located at
A:\volumeTrueCrypt.tc
With c# I do:
static void Main(string[] args)
{
var p = Process.Start(
fileName:@"C:\Program Files\...
6
votes
3
answers
24k
views
My own backup program was detected as "Win32/Bearfoos.A!ml" virus
I made this backup program more than a year ago. It had never been detected as a threat before. This morning when it tried to do what it always does, Windows Defender quarantined it, calling it a ...
6
votes
3
answers
1k
views
On windows, connect to a Virtual PV VM running Ubuntu for things like memcached, etc
I am on Windows 7, building an ASP.net web application.
There are a few services that I need to connect to, and don't want to go through the hassle of installing them on Windows.
I also run ...
6
votes
2
answers
4k
views
Stop Visual Studio text editor from auto moving comment lines
Is there a way to stop Visual Studio text editor (2015 or 2017) from auto moving the comment lines when pressing Ctrl+K,D or relevant key stroke (Ctrl+E,D - format entire document) ?
I would like my ...
5
votes
4
answers
2k
views
Shortcuts to exe on network pc ok?
I created a simple calculator in C# for work. It's just one executable file. I was thinking of putting a single copy of it on a network drive and send everyone a shortcut to it to access it. I'm new ...
5
votes
2
answers
9k
views
Better Windows mouse sensitivity multiplier control?
(I know this question has been posted before; I reposted a more detailed explanation on the situation because the previous question isn't answered and has over 6k views.)
The mouse speed Windows ...
4
votes
6
answers
33k
views
How to recover my source code?
after a system crash down, one of my .cs file get lost.
The size of the file is 18KB,
when I tried to open it in VS2010, vs2010 auto opens it in NotePad, but the content is empty.
I tried to open it ...
4
votes
1
answer
7k
views
How do I find the applications that require the .NET framework?
Is there a way to look at all the applications installed on a users computer and determine which, if any, are utilizing the .NET framework? My problem is that I want to upgrade our users computers ...
4
votes
3
answers
2k
views
Mapping a https://... as a local logic drive?
I can map a network share point to a local logical drive by using net.exe like this:
net use J: \\cnf001\test\folder1 /user: ...
I build a C# lib to use Process to simulate the mapping. Now I have a ...
4
votes
2
answers
688
views
"Stream" an app?
Is there a way to "stream" an application on windows? This might not be the right place to ask this, but, is there a way to, say, stream something like Avast from one computer to another, and then ...
4
votes
1
answer
786
views
Microsoft Visual C# 2010 Express error loading Silverlight
What's going on?: After selecting Silverlight Navigation with Accent Color from Online Templates in Microsoft Visual Studio C# 2010 Express, I am receiving the following error message.
Error: this ...
4
votes
1
answer
1k
views
Can window snap be programmatically rotated when monitor is rotated to portrait?
My secondary monitor, which normally uses 1680x1050 resolution, is rotated (physically & through Windows) to be displayed vertically (1050x1680).
Is it possible, programmatically or via registry,...
4
votes
0
answers
775
views
Visual Studio Code for Mac IntelliSense "Console" not working
Microsoft announced today that they have released Visual Studio Code for Mac, Linux, and Windows. I am trying to use IntelliSense for the keyword "Console" but nothing is showing up. I have tried ...
3
votes
10
answers
2k
views
Warm-up .NET application
We have speed problems in corporate enviroment.
Most of the notebooks are strongly loaded: the start-up time of Excel is 3-5 minutes, Outlook 10-15 minutes etc.
Our application has the same start-up ...
3
votes
4
answers
22k
views
What is the best way to run a Console Application once per day at a certain time?
What is the best way to run a Console application (C#) once per day at a certain time on Windows XP? I want to see the Console window.
3
votes
2
answers
4k
views
Edit and continue not working for asp.net core 3.0 with VS 2019 (C#)
I have VS 2017 latest Community edition installed on my machine. I was able to edit any class file and razor pages (cshtml) of my ASP.Net Core web application while debugging. I installed VS 2019 ...
3
votes
3
answers
4k
views
C# Code Editor which does not require Admin Privileges to Install [closed]
I am a Support Engineer interested in learning Programming. I have borrowed a few books from Library to learn C#, however, my office PC does not have admin privileges. Is there any code editor for C# ...
3
votes
1
answer
795
views
C# 5 Language Specifiction in LibreOffice Writer
I've faced with very weird behavior of LibreOffice when opening C# Language Specification version 5.0 in it. When I open this specification in Microsoft Word 2013 on the title page it's written "C# ...
3
votes
2
answers
9k
views
Why does explorer restart automatically when I kill it with Process.Kill?
If I kill explorer.exe like this:
private static void KillExplorer()
{
var processes = Process.GetProcessesByName("explorer");
Console.Write("Killing Explorer... ");
foreach (var process ...
3
votes
1
answer
5k
views
How does computer sleep mode works? How RAM holds information even if power is cut off in sleep mode?
How does computer sleep mode works? How RAM holds information even if power is cut off in sleep mode? RAM is volatile memory which erases everything when power is cut off but if i put my computer to ...
3
votes
1
answer
456
views
Install sql server management studio API only
I have already installed sql server 2008 R2 , but now i need to install sql server management studio also ( i mean just that API ony ) is it possible to install only this instead of uninstall sql ...
3
votes
1
answer
370
views
Why doesn't Firefox trigger UAC notification on Windows 7?
I have a C# (WPF) application (my own creation) that needs to open a port on the computer. This means that it requires administrative privileges to run. The app is currently unsigned and every time I ...
3
votes
3
answers
47k
views
Can't open an .exe app made in c# with Visual Studio
So I made a simple calculator console application with C# and Visual Studio. Now I gave the .exe file from my debug folder to a friend to test the application. Unfortunately, when he tries to open it, ...
3
votes
3
answers
5k
views
How can I password protect shortcuts on the desktop? [closed]
I wish to password protect specific programs before they are executed.
For instance, I have just downloaded Google Chrome, and have a shortcut for it on my desktop.
I am wondering if it is possible ...
3
votes
2
answers
3k
views
Visual C# - Program Will Not Run
I made a program with Visual Studio 2010. It required .NET Framework 4.0 to run, and the machine it needs to run on is not connected to the internet, so I found the redistributable online on my own ...
3
votes
1
answer
796
views
Centralized management of app.config parts for self-hosted .NET services
What will be the best way to handle these scenarios, if they are not one-time, but regular:
Self-hosted services on a quite a bunch of machines are needed to be repointed to different database in a ...
3
votes
4
answers
3k
views
connect to two networks from one computer simultaneously
I have two very separate networks that I'd like to monitor with one computer.
I am working on creating a simple windows form app that monitors the availability of each network by pinging a server ...
3
votes
0
answers
1k
views
update assembly version on git commit in Visual Studio
I am facing a nightmate of keeping track of not one, but 5 applications that regularly update and work together in tandem.
On each update, I must manually update AssemblyInfo.cs file with ...
3
votes
0
answers
2k
views
gpg: xxxx: skipped: public key not found
I'm getting this error:
gpg: xxxx: skipped: public key not found gpg: [stdin]: encryption failed: public key not found
I'm using this code:
IEncryptionService encryptionService = new ...
3
votes
0
answers
4k
views
stream byte arrays to a video using ffmpeg
This is what I am trying to do:
I receive jpegs from an IP camera. If motion is detected I want to upload the jpeg still shot to my server.
To save on bandwidth I save each jpeg to a file on my ...
3
votes
0
answers
1k
views
Microsoft ClickOnce Deployment with SFTP possible ?
I know that we could use FTP, Remote Website and Desktop to deploy our applications.
I would like to know if anyone could suggest how to use SFTP instead?
Are there any plugins that exist for this?
3
votes
2
answers
2k
views
Why is Process Explorer not showing the .Net information in the .Net columns?
I see the process but the Heap Bytes, Gen 0 Collection cols are blank.
Can someone tell me how to fix this?
2
votes
1
answer
2k
views
C# windows 7 run exe before computer shutdown
I want to run an executable that saves an XML file on a local drive before the computer (running on Windows 7) gets shut down.
I know it is possible to run scripts before shutdown. This can be ...
2
votes
4
answers
653
views
uTorrent automatic scheduling program
I am using utorrent on a mini "home utorrent server" full time. And when I go to bed, I have to manually set up the bandwith limit to max. And in the morning, I have to set it up to, say, 60% of the ...
2
votes
2
answers
3k
views
C# lost local variable window from debug (f11 step by step)
I was running my code (visual studio 2010) and I accidentally closed the window that shows the state of variables step by step. I think it was called locals but I can't find it on any of the menu ...
2
votes
4
answers
4k
views
Install Visual Studio on Cloud computer?
Is there any know cloud computer solutions out there that lets me install development software like C# Visual Studio 2008?
im looking for a solution that lets me log in from both work, home or at a ...