Creating Visual Studio AddIn run error - visual-studio

This has been happening to me over and over for every single AddIn project I make.
I create the AddIn projet from the template wizard and work on it, coding and debugging for a few hours and then all of a sudden I get:
Error 1 Unable to copy file "obj\Debug\Project1.dll" to "bin\Project1.dll". The process cannot access the file 'bin\Project1.dll' because it is being used by another process.
Does anyone know what is this about?
Happening in VS2008 and VS2010.
Thank you
*Edit: I have found a workaround by closing all instances of VS, deleting the Project1.dll file, selecting NO when VS asks me if I want to delete a reference to the AddIn when opening VS instance again.

I actually came across this today and it took me forever to figure it out. For me I was creating an Addin that automatically loaded when Visual Studio starts. The way I fixed it was by going to:
Tools -> Add-in Manager
Then uncheck the first checkbox near your addin. Keep the "Startup" checkbox checked to continue having debugging of your Addin.
Hope this helps.

Related

Visual Studio - Error when clicking on Solution -> Properties (Object reference not set to an instance of an object)

When i try to access my solution Properties, i get the following error:
Object reference not set to an instance of an object
I am using VS 2012. What could be the cause of this?
Some extensions may cause this.
Try disabling extensions and restarting Visual Studio.
Quite often error will be gone even if you re-enable extensions after this.
There's a bug report on Microsoft Connect (link).
It is marked there as "Closed as External", but it seems that it may occur randomly with any extension, so would be worth voting it there to bring it to Microsofts attention.
In my case, the problem was solution-specific. NuGet was causing this error, but not the extension itself but a NuGet package that generated an error on VS load. When I opened NuGet Package Manager Console I saw a big red text with a description of the error. In my case it was T4Scaffolding.Core package, which in turn is a dependency of MVCMailer.
If this is your case, you will probably see what package generates an error in PM Console.
I faced this dialog too and i'm not sure what exactly causes this as i couldn't even open the NuGet console to see detailed error messages.
Closing Visual Studio, deleting %AppData%\Microsoft\VisualStudio and restarting Visual Studio worked for me as it causes a reset of various things like window configurations.
I think if this dialog is displayed some files may be corrupt in %AppData%\Microsoft\VisualStudio and by deleting that folder Visual Studio can start normally again.
Update:
The issue arises on my machine when i start Visual Studio by using "run as administator" whereas Visual Studio has been started before without that option and %AppData%\Microsoft\VisualStudio had been created without the administator association.
Visual Studio 2013: I had this issue when I tried opening TOOLS -> Extensions and Updates.
I used #ViRuSTriNiTy idea, but only cleaned the files from:
C:\Users[myUserName]\AppData\Local\Microsoft\VisualStudio\12.0\Extensions
There are 2 cache files over there.
Deleted them and restarted VS2013 and it was fixed
The way it was happening for me might be unique to me/my setup, but I'd love to know if anyone else has this happen, and if they find out why:
If I launch an .sln file by double-clicking it, it will load VS and I can right-click the Solution and get Properties to come up no problem.
If I go to "Open Project" on the Visual Studio welcome page or from File > Open > Project/Solution, navigate to the .sln file and launch it by selecting it and clicking "Open" in the File dialog, that's when I have this issue.
I'm going to just always launch the .sln file from now on, but I'd love to know why this happens when using "Open Project" from the welcome page or from File > Open > Project/Solution! I tried going into Tools > NuGet Package Manager > General and I unchecked the options for allowing NuGet to download missing packages and Skip applying binding redirects, and under Package Sources I de-selected the checkboxes (my dev machine does not connect to the internet). Environment > Extensions and Updates: I tried it with and without "Load per user extensions when running as administrator" and running it as an Admin and without running as Admin. Also tried just deleting everything at C:\Users\me\AppData\Local\Microsoft\VisualStudio. No change from those 2 bullets above.

Visual Studio 2010 hangs on attach to process / debugging

Whenever I try to debug a Visual Studio 2010 web project, VS hangs, and ultimately crashes. This happens if I try to start the project using F5, or through Attach to Process, before the process list even appears.
Hitting F5 in, for example, a Windows Form project works fine, but attach to process fails here too.
Any ideas on what can be causing this? Obviously attaching to the devenv.exe process won't work as I can't get the Attach to Process dialog to appear...
Oh, running W7 (x64), VS2010 SP1 (had same problems without SP1)
In Solution Explorer there is a Show All Files icon (highlighted in the photo below):
Make sure it's turned off,
When It's turned on, Visual Studio tries to index all the files in the solution and if you have a giant Solution it could take forever!
I hope this has helped someone :)
Have you recently installed Mono and/or Mono Tools for VS2010?
I found that to be the problem it my case. Not sure why, but it somehow got in the way.
Matthew
In my case hangs when executable type was not correctly set, ex. Managed v4.0 and trying to attach to Native.

Lift VisualStudio write lock on an addin dll

I am trying to find my way around the addin concept of VisualStudio 2010 but I keep on getting the same error when I compile the solution:
"unable to delete file '.\bin\VSA.dll'. Access to the path [...] is denied"
I suspected this would happen when the addin is loaded in the "dev instance" of Visual Studio while I try to compile the solution, but the addin seems to be correctly ticked out in the "Add-In Manager" and the .Addin file contains <LoadBehavior>0</LoadBehavior> which should be right.
Any idea what could be causing the lock or how to track down what is? Thanks!
You have to restart VS for the addin to get unloaded, ticking out the checkbox won't unload the assembly from devenv.exe.
What seems to be working for me is to have the addin ticked out and start 2 instances of VS one with the adding project opened and one to debug the addin in.
Then enable the addin in the second instance to trigger the addin's initialization and debug it.
Disable the addin in the second instance of VS, close the VS.
Recompile the addin project in the first instance, start a second instance again.
Another simple way is to tick off the checkbox, close Visual Studio, delete the output files and finally restart Visual Studio.
Unlocker is a useful program for when you're unable to build because your dlls are locked.

Why would my Visual Studio 2008 close everytime I open a .xaml file?

Visual Studio 2008 has been very stable for months on my computer.
This morning when I double-click on any .xaml file to open it, or even click on the tab of an already opened .xaml file, Visual Studio says "initializing toolbar" in the status bar and then 20 seconds later fully closes the whole application without any error message.
Other files (e.g. .cs class files) I can open fine.
Has anyone experience this or know what I could check/change to be able to use Visual Studio to edit .xaml files again?
MORE INFO: I can also create a new project and create and edit .xaml files fine.
MORE INFO: I can edit .xaml files in other modules (projects) fine.
MORE INFO: Everytime it crashes, this event is registered:
.NET Runtime version 2.0.50727.3053 - Fatal Error in executable module (72555E00) (80131506).
(odd since I have .NET framework 3.5 installed)
MORE INFO: It is only in one module (project) that .xaml files cause Visual Studio to crash. Even creating a new UserControl in that module crashes Visual Studio.
I get this occasionally (with .xaml and .resx files) and find that if I delete the solutions .suo file things work fine again.
[The suo file just contains per user settings like recently opened files etc so it's nothing important and will just be recreated when you next open the solution.]
I've been getting the same issue whenever I try to access project settings for a C# project.
Found additional information about this:
Here: http://blog.fryhard.com/archive/2008/11/26/visual-studio-2008-closes-at-build-outlook-2007-add-in.aspx
And here: http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/99e124d0-c5d7-49c0-b1dd-71328f9a6571/
Apparently it's a bug in the core CLR engine that causes the entire CLR to crash if certain types of assemblies are loaded in a certain order.
Most of the time it appears to be directly related to the Visual Studio add-in called PowerCommands - uninstalling PowerCommands will make the problem go away.
And (we hope) it's supposed to be fixed for .Net 4.
This sounds very similar to the issue I had when I first installed VS 2008. Unfortunately, after hours of research, I ended up reinstalling the IDE (with my fingers crossed). No problems since then, but it's obviously not the most enjoyable way to solve the problem.
What is likely happening here is that one of the controls referenced directly on indirectly in your designer is stack overflowing during the designer process. Because the designer is hosted in process a stack overflow by one of the components will take down the designer and VS.
Try attaching a debugger to VS, break on first chance StackOverflow Exceptions and open the designer.

Visual Studio Add-in not going away

Ok, so I demo'd Refactor Pro and Resharper, I'm more comfortable with Resharper so that's what I bought. When I uninstalled Refactor Pro I thought everything was breezy. However, now when I open Visual Studio I get
The Add-in 'DevExpress Tools' failed to load or caused and exception, woudl you like to remove this Add in?
If you choose yes, the file it was loaded from,
'C:\ProgramData\Application Data\Microsoft\MSEnvShared\Addins\DevExpressToolsOrcas.Addin' will be renamed.
I hit yes, then get:
"Could Not rename Add-in file "C:\ProgramData\Application Data\Microsoft\MSEnvShared\Addins\DevExpressToolsOrcas.Addin"
This happens every time, I went to that location and there is not folder by that name. I searched for that file and nothing.
Anyone experience a clingy add-in?
I had the same issue with the VS.NET 2005 version and I'm not sure it is related. It was a registry problem and when i contacted the people from devexpress they send me a clean up tool.
You can try to see if there is another clean up tool for 2008 or search in the registry for the file name and remove it manually.
This page has instructions on how to manually remove a Visual Studio add-in:
http://www.mztools.com/articles/2006/mz2006018.aspx

Resources