How to debug VS add-in? - c#

I am trying to modify a VS add-in, this addin has multiple projects. The addin project itself, some class librarys that it uses an an user interface project.
When I try to debug I get the error "A project with the output type of class library cannot be started directly." Since all projects essentially have the same output type, I am not sure what to do. I tried making sure the startup project is the actual vs addin project, and I still get the same errors. I have never worked with an add-in before so I figure I am probably missing an important step here. I am using vs 2010, and the addin targets that aswell.
Any help would be appreciated.

Did you try to specify Start external program property of Debug section of the project properties? Try to set a full path to Visual Studio exe (something like "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe")

Related

Create TaskPane in Outlook with NetOffice

First things, I am a beginner in developing Add-Ins and I didn't find a good documentation for using NetOffice.
I have created an automation Addin project with the NetOffice Developer Toolbox. I want to create a TaskPane. When I start the project it throws the following exception:
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.
May someone can tell me what is necessary to start the TaskPane.
This is my Solution
I appreciate any help.
To debug the NetOffice addin project, you must change the Debug properties of the project in Visual Studio - set the Start external program to point to your installed MS Outlook EXE file.
If the add-in is correctly registered, you can debug the Task Pane.
More info: https://stackoverflow.com/a/3363236

Visual Studio: "Project with an output type class library cannot be started directly"

I checked out a solution consisting of two Visual Studio 2012 projects from a TFS repository. The first is a Visual Studio Add-In, the other project is a WPF User Control Library. As the library cannot be started directly, I selected the AddIn as the StartUp project. Nevertheless, I can't run it as it always reports
Project with an output type class library cannot be started directly.
I get this error if I try to run the UserControl library alone, which is totally legit. But I definitely get the same error trying to start the AddIn. I have a project with exactly the same setup, which just works fine. My colleague does not have this problems to, working with the same TFS checkout.
There exist several threads concerning this question (like "A project with an Output type of Class Library cannot be started directly") but I didn't find an answer there.
Any suggestions or ideas? Thank you!
Add-ins can't be started directly either. You've set the add-in as the startup project on the solution. Now you need to go into the properties of the add-in project. Output type should be dll. Start action should be "start external program"
In the box, supply the path to VS, for me it's...
C:\Program Files (x86)\Common7\IDE\devenv.exe
Then command line arguments should be...
/resetaddin <YourAddInName>.Connect

Unable to Debug my Add-in solultion

I am working with Add-ins for the past 10 months. I have not faced problem like this before. When I try to debug my Addin Solution in Visual Studio 2008, I get the following error.
Could anyone please help?
A project with 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 error makes sense, you need a hosting process for you addin, e.g. Visual Studio. I usually follow this workflow when debugging my VS addins:
Build your addin library in VisualStudio instance A.
Start VisualStudio instance B.
Load the Addin in VS instance B
In VS instance A, go to Debug | Attach to Process. Select the VS instance B process and attach your debugger.
Once you've done this you can set breakpoints etc just like any other process.

Can't find C# class template file in Visual Studio folder

I am trying to create an Visual Studio 2010 Add-In that when run adds a class to the opened solution's first project using EnvDTE.
I've managed to create the add-in, get the reference to the opened solution and get the reference to the first project.
Then I want to create the class, and I've found the following code:
String templatePath = sol.ProjectItemsTemplatePath(PrjKind.prjKindCSharpProject);
templatePath += #"\CSharpAddClassWiz.vsz";
The path points to a template file that does not exist. Everywhere I try to get this file, it’s stated that “you could find it in Microsoft Visual Studio 10.0\VC#\CSharpProjectItems”
Here’s the entire content of this folder in my installation of Visual Studio 2010:
http://i.stack.imgur.com/YFsMw.png
In fact I’ve searched for the file, and even for *.vsz in my entire hard drive, and nothing was found.
I have two questions:
1) Did I install Visual Studio incorrectly, so that this file is not available in the Visual Studio folders?
2) How can I get this file, even if it is a copy of it?
I do realize that having a copy of it and shipping it in with my Add-In would mean that in the future, people could generate classes with an old template, rather than the updated ones found in their Visual Studio folders, but I just want to proceed with my tests,
generate this class, and move on until I have the first question solved.
There are two things that intrigue me on this matter:
Doesn't Visual Studio use these files while I'm creating classes through it's wizards?
I have Visual Studio 2008 installed too, and it also lacks these files.
You may have to run a repair on Visual Studio, it is likely that there was an error during the install.

How can I debug the uninstaller part (with CustomAction) of an installer project in Visual Studio 2008

I have inherited this c# solution that includes an ix installer project (a bunch of .wxs files and some c# files). The uninstaller is generating an error message.
I haven't a clue what this installer project is. What are the .wxs files for? I can guess (and have successfully been able to fix some issues with the installer. I have figured out how the custom actions are set up and called etc.
But the bug in question would be so much easier to debug if I could step through it in the debugger - how do I do that?
Generally: How do I hook up the Visual Studio 2008 debugger with the installer project ("Set as Startup Project" is not an option in the Solution Explorer, tried that).?
Specifically: How do I debug the uninstaller? The way I see it, the uninstaller will have to use a dll not residing in the project folder (where?) and thus not really known to Visual Studio at all...
Maybe this article on MSDN will help.
I haven't done it recently but I think that if you add anywhere in the code Debugger.Break() statement, you will get a prompt during the install to debug the process and then you can step through it.
One of the pages that look promising is the WixWiki.
I found this on the wikipedia page for WiX.

Categories

Resources