I need to debug run a C# project using a different user. I found this link, However, it's old.
How do you debug a project as a different user in Visual Studio 2022?
The Launch Profiles doesn't have the executable field.
If you mean how to using the approach for a .net core project, here is the steps:
Click the downward arrow in the picture and choose "<project> Debug Properties".
In the dialog click the first button and choose "Executable".
Input the executable and arguments.
Select the new profile (in the first picture) and start debugging.
Note that with this approach you still need attach to the process, see the comments in this answer: https://stackoverflow.com/a/1287221/6196568
I have created a UWP application in Visual Studio. I plan on using it only for side loading(it is a LOB app). It doesn't have any errors. But when I try to package it, I get the following errors.
Errors in Packaging
0X8007000b an attempt was made to load a program with an incorrect format
Also, here is my output console.
How do I fix this?
From the solution explorer, double click and open Package.appxmanifest
Click on Visual Assets tab on top. It is second from left, after Application tab.
Select a source image (this is the image you want to use for logos, badges, splash screen, etc.)
Under assets combo box, select all All Visual Assets
Hit Generate
Say ok that it will overwrite your existing files
Now, if you want to use a different image for any of the specific areas, for example, App Icon, scroll down, and provide a different source for it.
Now, build and make sure your app builds. Then attempt to create the app package again.
I'm using a setup project in visual studio 2010 to create an installer for a program I'm working on. I want to have a custom banner image in my setup as well as a custom icon in add remove programs.
I've added both these images to the "Application Folder" of my installer and was able to get them to show up correctly. However, my program is not very big and only installs as an EXE and a few DLLs. So it seems a little silly to me that the 4th and 5th files that get "installed" are graphics only used during installation.
Is there some way I can embed these images in the installer or one of my other projects?
I'm currently using VS 2008 and just been playing around with the setup project. I believe the following works - it did in my tests.
Select the setup project in the solution explorer window.
Right click and select Add/File
Find your banner Image file and add it.
You will see that it's been added to the Application folder.
Select the banner file in the application folder - or in the project list on the solution explorer.
Open the Properties Window
On the properties set "EXCLUDE" to TRUE.
When you set exclude to true you will see the banner file removed from application folder - but it will still be shown in the project tree - the icon will for the file will have a little red circle with a line through it.
I've done this with both the banner and a custom icon and tested my install - worked fine with both and neither file showed up in the application folder.
Hope this helps.
In the setup project properties you can put an image for the add/remove icon in the property AddRemoveProgramsIcon
For the banner image, right click on the setup project, View -> User Interface, click on the page you want, and then in the properties you want the BannerBitmap property.
This blog discusses a way to change the banner image without modifying the Visual Studio project.
If you want to change of the icon of the application EXE, then you just need to right click on the EXE and "create shortcut". In the properties you will find the icon and you can change it.
In program.cs file and in line that we choose first form,Iwant to show form1 when my application runs. But when my application runs, form2 apears.
I don't know what options I changed.
Not bad you know that when I change my codes and I want to close visual studio,there are no warning me to save and when I have an error in my codes,visual studio doesn't ask me that "you have an error in your application" or something like this.
Please help me to restore my defult options.
Thanks.
Perhaps Tools / Import and Export Settings / Reset all settings?
Can't say I've ever had Visual Studio fail to prompt me to save dirty files on exit, or on a build failure...
When you create a new solution/project in visual studio and you don't save it visual studio won't track changes and/or ask you to save things. Hit save once to save you're data/solution.
In the main function you can tell wich form to start, if you're using vb.net you can use the project properties page too. You can use a right click in the solution explorer to set a 'startup project'
I downloaded a C# project and I wish to debug the project to see how an algorithm implementation works.
The project has come in a Folder, inside this folder there are -
.sln file and
a folder which has source files and a .csproj file.
I installed Visual Studio and opened the .sln file present in the main folder. I built the project successfully, but when I try to debug the project I get this message:
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.
The strange part is that I don't see a main function anywhere.
What should I do to get round this hiccup?
The project you have downloaded compiles into a dll assembly and provide a set of classes with implemented functionality.
You should add to your solution a new project with Output Type of either Console Application or Windows Application (VS Add Project wizard will offer you different templates of Projects).
In the newly added project, you can implement logic to test your Class Library.
Output type of the project you can find and change by the following steps:
Right click on project in Solution Explorer -> Properties.
In opened tab with properties select Application and there will be ComboBox marked with Output Type label.
Just right click on the Project Solution
A window pops up.
Expand the common Properties.
Select Start Up Project
In there on right hand side Select radio button with Single Startup Project
Select your Project in there and apply.
That's it. Now save and build your project. Run the project to see the output.
This was the solution that worked for me since I couldn't find 'Common Properties' option.
Select your topmost level project in Solution Explorer.
Go to Project, and in contextual menu Set as StartUp Project.
See also: A project with an Output type of Class Library cannot be started directly
Just needs to go:
Solution Explorer-->Go to Properties --->change(Single Startup project) from.dll to .web
Then try to debug it.
Surely your problem will be solved.
The strange part is that I don't see a main function anywhere.
That is exactly your problem. The project merely creates a DLL. It has no executable to run.
You will need to add a second project, which is an executable which references the other project, and calls something in it.
1) Right Click on **Solution Explorer**
2) Go to the **Properties**
3) Expand **Common Properties**
4) Select **Start Up Project**
5) click the radio button (**Single Start_up Project**)
6) select your Project name
7) Then Debug Your project
Right Click on "Solution Explorer" -> "Properties"
Expand "Common Properties"
Select "Start Up Project"
click the radio button "Single Start_up Project"
select your Project name from the drop down list.
If still not working after the above steps, then try this.
Expand solutions explorer.
Right click on project name -> "Properties"
Go to "Application" tab
Select "Output type"
From the drop down list select the appropriate type according to your application.
"Windows application" or
"Console application"
Then save (ctrl + S)
Try debugging (F5)
You'll need some kind of app (Console Apps are my favorite for debugging, but a WinForm will do) which uses your Class Library. Just add a new project (in the same solution) of a Console Application or Windows Forms Application, and add a reference to your current project. Once you've done that, make any calls you need, set your break points, and go to town.
I had a similar issue when trying to use the Experimental Instance of Visual Studio 2013. This was for a vsix project (Creating Snippets).
Solution was:
Right Click Project in Solution Explorer > Properties > Debug
Setting the Start Action to "Start external program" and using the following path:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe
This option was set to "Start project" which won't work for the application output type Class Library, which caused that same error.
Note: Yours may differ depending on how you installed VS.
Error solutions is that you have already open your project but by mistake you have selected another class library .. that's reason this error is showing ... so what u need to do you u just select u r project then right click on u r project
after right click u can see the list box and select the "Set as start up project " option .
Accepted answer works if your solution has a project that compiles to an exe. If your solution does not have any projects that compile to an exe, then you have to use 'Start external program'.
VS2019 instructions:
right click -> properties on the main solution
debug, start external program, and add command line arguments
VS2022 instructions:
right click -> properties on the main solution
scroll down to Debug
Debug > General > Open debug launch profiles UI
left click the 'new' icon in the top left, select 'executable'
fill it out as per VS2019 (pick the exe and add command line arguments)
when clicking the start button, first select the profile you made
Suppose you have multiple project in the solution. Select the project that you want to view in browser and select 'Set as StartUp Project'. In your multiple project soln which was the main, the visual studio was unable to identify. this was the main problem.
You can right click the Class Library project and from the drop-down choose Initialize Interactive C# which will load your project context and you can work it in the interactive session.
In my case, the cause was that one of my projects in the solution wasn't loaded. The reason it couldn't load properly was that the file path length of one of the files was too long. Upon deleting this long file, I could reload the project, and build the solution.
If the question involves an Azure project, make sure you have the "Azure development" tool set installed, or when you go to run a solution you may get this same error.
Tools > Get Tools and Features... > Tick the box next to Azure development > Click install
None of the answers provided above helped me resolve this error, this is what resolved the issue for me.
Right click on the solution and select "Properties", which is in my case "Sintctech.Data".
Select the section called "Application".
Check what you have selected as your output type. If it is "Windows Application", change it to "Console Appication".
Rebuild and the problem should be fixed.