Visual Studio not Compiling Sometimes - visual-studio

I am using an ASP.NET site on a ISS Server on a Windows Server 2008 that compiles a solution for me In the following matter:
Dim command = "devenv ""Solution.sln"" /build Debug /project ""Project.vbproj"" /projectconfig Debug /out ""logBuildUpdateInfoprim.log"""
Dim cmdsi = New ProcessStartInfo(command)
cmdsi.Arguments = arg
cmdsi.CreateNoWindow = True
cmdsi.UserName = "user"
cmdsi.Password = "pass"
cmdsi.UseShellExecute = False
Dim cmd = Process.Start(cmdsi)
cmd.WaitForExit()
The "user" and "pass" are for a system adminitrator
I also set the Identity of the site's Application Pool as the "user"
And it works for about a few weeks and then at the next compilation the devenv process just sits as 0% processor and ~2Mb of RAM. And it sits indefinitely.
The only way to fix this is to log as the "user" in windows, close the devenv process manually and then open Visual Studio. After that I can logoff from the windows server and the website works again for a few weeks.
(I am using Visual Studio Community)
I suspect that Visual Studio needs to be open so it activates the Visual Studio account, or maybe it's a issue with the windows server. Anyway, it's a real pain to periodically have to fix the issue.

Since I did not find any answers on how to bypass the login in Visual Studio I used
msbuild.exe
as a workaround.

Related

Visual Studio 2012 Break points not hit

I am having an issue with Visual Studio 2012 where break points are never being hit unless I enable
'Allow the source code to be different from the original version'
When, I do this I get a warning that the source file differs from the debug version.
I have reset the settings in visual studio and this has made no difference. I have also created a blank project and the same thing still seems to be happening.
To try and fix this I have:
1) Rebooted the pc
2) reset all VS settings
3) Created a new blank project
Any would would be appreciated.
I have seen this occur when an IIS express process gets hung up. Please close all instances of Visual Studio 2012. Then open up windows task manager and find all process that have the image name of iisexpress.exe and make sure to end those process. Then restart VS2012 and you should be good to go.

Application Debugging is disabled in Visual Studio 2012 on Classic ASP Debugging

I'd like to debug Classic ASP website at Visual Studio 2012 with IIS Express. Hence, I attached the iisexpress.exe in VS 2012, but it shows Application Debugging is disabled. What could be a problem ? Do I want to enable any configuration settings?
First of all you need to enable server side debugging of classic ASP script. Do this by running the following commands:
"C:\Program Files (x86)\IIS Express\appcmd.exe" set config "[YOUR_SITE_NAME]" -section:system.webServer/asp /appAllowClientDebug:"True" /appAllowDebugging:"True" /commit:apphost
Where [YOUR_SITE_NAME] is the name of your website. You can find this name by opening up:
%USERPROFILE%\Documents\IISExpress\config\applicationhost.config
...and searching for your site.
Next, start an IIS Express instance from the command line:
"C:\Program Files (x86)\IIS Express\iisexpress.exe" /config:c:\users\kevin\Documents\IISExpress\config\applicationhost.config /site:"[YOUR_SITE_NAME]" /apppool:"Clr2IntegratedAppPool"
Again, [YOUR_SITE_NAME] is the name of your IIS Express website.
Then attach Visual Studio 2012's debugger and set a breakpoint in the script you wish to debug. Browse to your site/script and your should see the breakpoint light up:
Go to IIS-->ASP-->Debugging properties -->enable client and server side debugging
then attach w3wp process from VS2012
I don't have visual studio 2012 to test it on as far as I know visual studio cannot debug asp classic code natively.
The way I debug my asp classic code is to put in stop statements on the line above the one I want to debug
like this post says. the break point is just typing in stop.
function DoDate(inp)
stop
if isnull(inp) then
DoDate = "Never"
exit function
end if
In the above example the page when loaded will stop at the breakpoint and pop up a dialog asking if you would like to debug it, you can then step through the function and even see variables like you normally would.
note: The link says visual studio 2005 but it also works in 2010(and should also work in 2012), you also do not need the DEBUG extension.
also ensure you have server side debugging activated in IIS or this will not work.
I like using Full-blown IIS on my dev machine as it's what my web servers run and have had problems with differences between Casini and IIS in the past..
Anyway, I was unable to do it the way that #Kev suggested. I did some more playing around + reading and found that on the "Attach To Process" window, you need to specifically select "Script Code" in the "Attach To:" option.
1) F9 to set breakpoints in code
2) Ctrl-Alt-P to attach to process
3) Next to "Attach To:" click on the "Select" button
4) Select "Script Code"
5) In my case, attach to "w3wp.exe"
Enjoy debugging your code.

How to handle Visual Studio 2010 Not Responding?

First of all, I am not asking the same question here. ( This may be a duplicate post on Stack Overflow.) I have searched other solutions on MSDN, ASP .NET Forum, Stack Overflow, Code Project and everywhere on internet. But none of them solved my problem. These are the links that I found:
http://blogs.msdn.com/b/kirillosenkov/archive/2012/01/11/vs-hangs-for-1-minute-on-start-debugging-check-for-dead-symbol-paths.aspx
http://www.codeproject.com/Questions/272109/Visual-Studio-2010-Hangs-When-Debugging-App
And a lot more...
My CPU is 4th Generation Intel Core i7 and memory capacity is 8 GB. I think it is more than recommended hardware requirements.
Problem:
My visual studio hangs on these situations.
Opening a solution (Hangs for a minute when I open a file from solution explorer)
Running the debugging (Freezes consistently when I click on debug button) and
Stopping the debugging (Freezes immediately after the UI returns to the Developer layout after debugging)
I have tried the following steps:
I ensured that I deleted all the breakpoints in the solution.
I ensured that I am not using any resources from network drive.
I ensured Step over properties is enabled.
I ensured Enable .NET Framework source stepping is NOT enabled.
I start visual studio with SafeMode to suppress extensions
I cleared watch window.
I cleaned and rebuilt the solution.
Before I encounter this problem, I installed "Install Web Components" Visual Studio Add-In a few weeks ago. May be because of extensions and add-ins?
How can I do it to solve my problem?
If you suspect that Visual Studio settings get corrupted after installing "Install Web Component" bundle, why don't you try to reset the settings?
You can perform the steps below to reset Visual Studio settings:
Open Visual Studio Command Prompt (2010) under Start menu > All Programs > Microsoft Visual Studio 2010 > Visual Studio Tools (Run it with Administrator privilege: Right-click the program > Run as administrator)
Run devenv /Resetsettings to restore the IDE's default settings, optionally resets to the specified VSSettings file.
Run devenv /ResetSkipPkgs to clear all SkipLoading tags added to VSPackages.
Run devenv /Safemode to see if you can apply it correctly. This can eliminate the possibility that third party Add-ins or packages are causing problems.
Open your solution in Safemode and see whether it works.
Found this to happen also when the solution is connected to a Team Foundation Server and the service is not available at the moment, so the solution could not connect. In this case do not end the Visual Studio instance and wait until a message box show up giving the option to Go Offline. This is usually associated with the "Visual Studio is waiting for an operation to complete...." notification message.
My solution was simply to reload a saved GOOD (backup) copy of my settings (made a year ago). Worth trying before resetting everything to blank. My VS2010 would take 60 seconds to start debugging and approx. 3 minutes to stop debugging. I saved the corrupted settings and to my surprise they were over 3MB instead of 260Kb. I loaded the good backup copy and everything is great again :-)
If Visual Studio doesn't respond only when attempting to open solutions, then open a raw instance of Visual Studio then Reset Settings
Check How to: Reset Your Settings from the Tools Menu
http://msdn.microsoft.com/en-us/library/ms247075%28v=vs.90%29.aspx
This is Visual Studio 2013 and Windows 8.1
Open developer command prompt.
Start -> All programs -> Visual Studio -> Visual studio tools -> developer command prompt
Make sure that you don't have any pending changes that need to be checked in.
run this command : "tf workspace /delete 'your workspace/ machine name'"
yes for removing the unnecessary pending changes if at all present.

Debug a program that needs administrator rights under Windows 7

I'm running Visual Studio 2008 on Windows 7 64-bit. I'm logged in as administrator, and I'm running it as administrator, but the program I'm working on fails with access denied when I call a restricted API. If run the program from Explorer with "Run as Administrator" it works.
I was under the belief that Visual Studio 2008 debugs programs with whatever rights Visual Studio 2008 itself is running with. As it stands I can't debug my application due to this, and I'm at a loss as to what's going on.
This works for Visual Studio 2012.
Create a manifest file: right click on the project and select "Add New Item", select "Application Manifest File". This will add a file named app.manifest to the project.
Edit manifest file: set attribute level for tag requestedExecutionLevel to requireAdministrator.
Now your program will always require admin privileges, wherever it is executed. If launched by Visual Studio debugger, it will prompt you for restarting Visual Studio as administrator, if needed.
It's best to run Visual Studio 2008 as administrator. Moreover, it's good to change your application's manifest settings to require administrator privileges. You will be prompted by the system to elevate to system administrator each time you start your application, and when running under Visual Studio 2008 the IDE will offer you the elevation before start of debugging.
To change the setting, open project properties and go to Configuration Properties → Linker → Manifest file → UAC Execution Level.
I found the answer. It turns out that it is, in fact, a manifest issue: by default if you have a manifest you need to set the appropriate administrator privilege.
The default is asInvoker, but that doesn't work if you need elevated privileges; you instead have to set it to requireAdministrator in the manifest properties.
Run Visual Studio 2008 as administrator.
I had a case where I put in the
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
settings (described by another answer at this post)........and did not work.
I found another tip (seen below)...and unchecking that option allowed my code to work.
Try going into the project properties, and under the "debug" tab,
uncheck "enable the Visual Studio hosting process" and see if that
fixes your problem.
(from https://social.msdn.microsoft.com/Forums/vstudio/en-US/b5c4da93-5d64-442e-af28-df6d10765538/debug-as-administrator?forum=vbgeneral)
So I needed the app.manifest settings AND the "uncheck".
My testing with Windows Vista and Visual Studio 2005 showed that when you use a host process, the behavior under the debugger depends only on how you launched Visual Studio and not on the manifest (or lack of manifest) of your application. When Visual Studio is launched elevated, the behavior depends only on the use (or not) of a host process, not on the manifest. This is probably still true with Windows 7 and Visual Studio 2008.
Also, have you tried launching the application outside Visual Studio and using Attach to Process?

FAiled to attach Visual Studio 2008 to an application with IronPython on Vista

I'd like to create new command line to attach Visual Studio to an application with IronPython:
My Script:
import clr
import System
from System.Runtime.InteropServices import Marshal
DTE = Marshal.GetActiveObject('VisualStudio.DTE')
curLocalProcess = DTE.Debugger.LocalProcesses
print curLocalProcess.Count
currentProc = curLocalProcess.Item(1)
currentProc.Attach()
While, I encounter a problem on Vista:
EnvironmentError: Visual Studio has insufficient privileges to debug this process.
To debug this process, Visual Studio must be run as an administrator.
I suppose it's not a issue of IronPython but about Vista Security.
However, I cannot figure out a solution for this even after I run Visual Studio 2008 SP1 and IronPython as Administrator. Except that, I also turned off UAC.
I also notice that "Run this program as an administrator" in Properties - Compatibility tab for Visual Studio is grayed.
Do you have any comments or suggestions?
You need to invoke an elevated VSStudio IDE via script.
Or else run the app & script in Built in Administrator account or in a normal admin account with UAC off.
using System.Diagnostics;
Process p = new Process();
ProcessStartInfo pp = new ProcessStartInfo();
pp.Verb = "runas";//Invoke as Admin
//Do other initialzation.
p.StartInfo = pp;
p.Start();

Resources