Cannot change thread mode after it is set - visual-studio

I have a C# app that I haven't worked on for a while. The last time I worked on this was with Visual Studio 2019. It still opens and runs in debug mode with VS 2019. IF OI open it with VS2022 it will not run in debug mode. I get and error:
Cannot change thread mode after it is set.
What causes this and what might the solution be?

Please follow the steps below:
Go to project properties by right-clicking your project name in the project explorer and choosing properties
In the project properties window, select Build on the left side of the list
On the right side make sure you uncheck "Prefer 32-bit"
Save the project
Debug and test your project. This should resolve the issue.
Screenshot of Project Properties

Related

Can not build C# project with Visual Studio 2022

I don't know what happens with my Visual Studio 2022. When I create a C++ console project, I can build the project. However, when I do the same thing for C# project, I can not build the project. I look like in the picture. Any help is truly appreciated.
I tried everything I can but it didn't work.
That sounds like a bug. When a new project is created, it should appear in Solution Explorer. However your solution has no projects, and the source file appears in "Miscellaneous Files" (meaning it's not part of a project, and therefore VS won't know how to build it).
Please use the Visual Studio Installer to run a repair on your VS installation. If that doesn't help, use Help | Send feedback | Report a problem and include a recording of the steps you're taking to create a new project. If you link the feedback ticket here, I can make sure it gets looked at by the right people. Thanks.
You need to create a new Console App for creating and running C#
projects
Press F5, choose Debug > Start with debugging from the Visual Studio
menu, or select the green Start arrow and project name on the Visual
Studio toolbar. Or, to run without debugging, press Ctrl+F5 or choose
Debug > Start without debugging from the Visual Studio menu.

Prevent unnecessary apps from running in visual studio 2017

I have 4 runnable projects(specifically web apps) in a single solution. The problem is when i try to run visual studio all the above mentioned apps getting run in background, but not in browser. However the setup is such that only one app is meant to run. Startup Project is set as Single startup project only
Right click on Solution.
Select Properties.
Select a single Startup Project
I fixed this by doing the below steps in Visual Studio
Select the project you want to stop running in background
press F4 (this will open properties of the project, but not the property page opens by right click > property)
Set Always Start When Debugging to false
But remember this is a user to user configuration. You cannot set it for all your team members

Xamarin iOS Release Build fails

I am using Xamarin iOS in Visual Studio 2017 for Windows!
Building and debugging the debug Version of my App via a build host works great. But when I try to build the Release Version it says:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(3463,5): error MSB6006: "sgen.exe" exited with code 1.
Signing Identities are installed and vislible in VS.
I also found this Blog post. But the workaround is only for Mac Users.
Does anyone know what's wrong here?
Thanks!
Have you configured your iOS release? if not this may be the solution.
In Visual Studio, open Solution Explorer (Keyboard: Ctrl + Alt + L).
Right-click your solution and then click Configuration Manager.
On the configuration manager dialog box open the active solution configuration drop-down menu and click New.
On the new solution configuration dialog box:
For Name, enter iOS Release
Open Copy settings from drop-down menu and select Release.
Clear the Create new project configurations dialog box.
Open the Active solution platform drop-down menu:
Select iPhoneSimulator and clear the check boxes on all rows except
your Xamarin.iOS project and any projects (for example, portable class libraries) it depends on.
Repeat this step for iPhone.

Can't see emulator selection option in visual studio 2012 for windows phone

In my Visual studio 2012 for windows phone , I created one project and I developed some pages.
It is working fine and i'm able to debug by selecting the desired emulator option.
Suddenly the device options tab is not visible. It is looking like below.
For testing purpose I've opened another project, then for this project i'm getting the emulator option. It is looking like this.
I didn't understand why it is happening with the first project. could you please tell me how to enable emulator options for the first project.
Thanks.
If you have multiple projects in your solution then the one that is set as the 'StartUp project' is probably not a Windows Phone app.
The options included in the menu relate to the startup project only.
To change the startup project, right click on the project in the solution explorer and select "Set as StartUp project".

Why does Visual Studio launch multiple WebDevs when I debug?

I have a Visual Studio 2008 solution with several projects in it - some of which are web applications / sites.
Whenever I go "Debug > Start new instance" for a specific web application and VS launches the ASP.net Development Server (WebDev.WebServer.EXE) for that application, VS also launches 3 additional such processes - one for each of 3 other web applications I have in the solution.
How can I tell Visual Studio to only launch WebDev for the one project I'm debugging? I've looked both in the project configurations and in the solution configuration and could not find the relevant setting...
I think it runs one for each Port -- you can try turning setting them to have the same port - click on the project and look at the properties pane (you have to turn off the the automatic port generation and then set the port#)
I tried the above solution but it did not worked. My solution was a vs2005, what I found to solve the project was to make the property window of VS 2008 visible. Then click on the web projects and then set the "Always start when debugging" property to false and this should take care of it :(
In Visual Studio 2008, there is an entry on the Properties page for the project called "Always Start When Debugging".
Note you have to get to this by selecting the project and going to the Properties pane (or right-clicking Properties). This option is not present when you double-click the project and open it in the main editing pane.
VS by default sets this value to on for all your web projects. Turning it off will solve this problem.
[editorial]This is fairly annoying and I wish the default were false![/editorial]
Suggestion - don't use the internal WebDev, use IIS instead. Also reduces the clutter in the systray. ;)

Resources