This question already has answers here:
Can't run program because it asks me to attach on process
(5 answers)
Closed 2 years ago.
I'm new to C# and using Visual Studio 2019 to learn C#.
Now after I create a new project I cannot run and debug it. The code is very simple.
enter image description here
But the start debugging is dark. Also, I found there is no project in the solution.
enter image description here
enter image description here
I just find that when I create a new project, something is missing in the project folder.
enter image description here
When I want to open the .csproj file, it gives me a prompt: unable to locate the .NET SDK.
Really appreciate someone who can point out what should I do or give any clues.
You have a single .cs file open. To compile it into an application, create a "New Console Project" in Visual Studio and copy this code into the resulting Program.cs. In the future, open up the *.csproj or *.sln files to work with the project, not just the individual .cs file. Good luck!
Related
This question already has answers here:
A project with an Output Type of Class Library cannot be started directly.
(2 answers)
Closed 4 years ago.
I cloned an Asp.Net MVC project from Github and I renamed it following the steps on this article https://www.codeproject.com/Articles/697108/Visual-Studio-Painlessly-Renaming-Your-Project-and
After that I rebuilt the solution and somehow visual studio doesn’t recognize my app as a web app anymore. The debug button used to show my default browser “google chrome” and when I hit F5 it used to open up in google chrome. Now the debug button shows “Start” and when I hit F5 to run, a dialog box pops up “A project with an Output Type of Class Library cannot be started directly. In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project”
Any help is appreciated.
I think you must choose property "Set as StartUp Project" on your project.
Right click on your project -> Choose Set as StartUp Project
This question already has answers here:
How to: Create Item Templates in Visual Studio 2017
(4 answers)
Closed 5 years ago.
I am using Visual Studio 2017. When I start a new Console App(.NET Core) it comes with a Console.WriteLine("Hello World!") by default. My question is if there is a way to permanently remove this line instead of deleting it every single time?
You can create your own project template. Get your project set up how you like, then in VS, go to the Project menu and select "Export Project". Follow the prompts from there. Then, next time you create a new project, you will be able to find your exported template in the project type selector.
Or delete the line.
A bit of a funny question. I've made a small C# program today as a test to learn how visual studio works. More specifically playing around with the "publishing" portion of the program.
I went to run it on another machine, and it says the author as the program name. Is there any way for me to change this so the author is my name?
Edit:
I've tried this link here: https://msdn.microsoft.com/en-us/library/y8bw4k20(v=vs.80).aspx
However can't seem to find the setup project folder.
As I understood, you want to change your program's author name. You can change that in AssemblyInfo.cs file under Properties in Visual Studio Solution explorer window
Ok I found the solution.
In Visual Studio, open up Solution Explorer. Open up the properties menu and open the file AssemblyInfo.cs
From there you can modify details of the program.
I have an C# source code of some software my company is using. This source code contains .xaml, .cs files, and one: App.config, packages.config. However there is no main project file that I can open in Visual Studio.
The original source code can not be found, and the programmer who made it has left the company long ago.
My question is - can I open such a project in C# somehow, without the main project file, so that I could make some changes and compile this application?
Just create a new WPF application project and add the existing files.
You can compile the code using the c# compiler csc (which you can find in the .NET Framework installation folder), or just create a new project in Visual studio and add the WPF files to it. The last option is the easiest one.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
how to rename a project without killing solution
I know that this question has been frequently asked, but none could help me overcome the fear of rendering my application useless by improper renaming of my solution,
I am working on a C# Windows application in VS 2008, as in initial step i was unaware of the fact that renaming is such a big issue in VS, i named the project "stock" but now that my project is nearly completed, my lead wants to rename the namespace to BetRates_NS as that is the name of the deployment setup project,
i even have web service references in my solution and other dependencies with the namespace name, ans based on my previous experience, renaming is not so easy in VS,
so can some1 please give me the exact step by step process to rename my solution so that the application might run smooth now and may not crash at a later point of time due to this.
i am totally hoping for some help here.....thanxx in advance......!!
this is my solution explorer screenie:
Try this
Press CTRL + H then enter your old name that you wanna change to a new name
by the option look in, you can also choose current project or entire solution
You can also change your namespace in your project properties
**
Or you can create a new solution, and add those projects to your new solution and build it