I'm checking NetOffice and trying to run a simple example from below:
https://github.com/NetOfficeFw/Samples/tree/master/Excel/02%20NetOffice%20Excel%20COMAddin%20Sample/01%20Simple
how can run this example in visual studio? ideally I think it should be opening a blank Excel which contains addin, but when debugging, it just an error "In order to debug this project , add an executable project to this solution...."
so what executable project I need to add?
thanks,
To debug this example, you must do two steps:
The add-in must be registered in the registry to load it when starting Excel.
This step is done automatically, when you built the add-in (this is part of the NetOffice "magic" with the COMAddin attribute).
You can do the registration of the add-in manually too by using regasm.exe.
Excel must be started so that the add-in is loaded and the debugger can be used.
I prefer to set this up in the project properties. Go in the project properties on the tab Debug, go on Start external program and select the path of the excel.exe on your computer.
You could also start Excel and attach the project debugging to the Excel process.
If you have done the two steps, then start debugging by clicking F5. Now Excel starts. If you set a breakpoint, then it should be reached either at the Excel starting process or when you open a workbook in Excel.
Related
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
In Visual Studio I can attach the debugger to any process that is currently running.
I have an application that is calling my DLLs and what I need is to debug this process from it's beginning. Is this possible?
Open the project properties (context menu, Properties or Alt+Enter)
Go to the Debug tab
Choose "Start external program"
Save and close
Choose debug mode
Run the application (F5)
If the application expects the DLL in a specific path, it may be necessary to add a post build step to copy the DLL to the expected location.
When I use the "new workbook" option as the start document, the add-in loads automatically but when i add my own test file it doesn't load. I have to go to manually start it in the insert tab.
How do i fix it?
I figured it out:
Simply click save in Excel after loading the app from the insert menu.
i create a debug version of an excel addin lets call it myaddin.xll. when i open an instance of excel and add myaddin.xll to it i get the expected result. but when i hit debug from within
visual studio environment the myaddin.xll tries to open and gives a "this program cannot be in dos mode" error.
for other excel addin i have developed i do not have this problem. this problem is suddenly occuring for this particular addin. "dos mode..." error usually happens when something is missing. clearly the addin does not have any missing component because it opens in excel. but the some component gets missing when i try to open from within visual studio. my question is how to i figure out what is causing the error and fix it.
when i hit debug excel opens up and then gives a pop up "you file myaddin.dll is in a different format than specified by the file extension...." when i hit ok to that pop up i get garbage characters in the spreadsheet.
You need to Configure Visual Studio to : 1) run Excel 2) load your .xll and 3) add your dll dependencies path (right click projet-"Configuration Properties" -> "Debug") :
-Don't forget to switch the extension ("Configuration Properties" -> "General) of the dll to .xll.
-Don't miss the Govert (loading a excel addin xll from visual studio debug) comment regarding x64bit versus 32 bits.
I have a problem debugging a C++ DLL project in Visual Studio 2010. While debuging I want the DLL to be loaded by rundll32.exe automatically. To do so I follow these steps (like here http://msdn.microsoft.com/en-us/library/c91k1xcf.aspx):
In Solution Explorer, I select the project that creates the DLL.
From the View menu, I choose Property Pages.
In the Property Pages dialog box, I open the Configuration Properties folder and select the Debugging category.
In the Command box, I type: "C:\Windows\System32\rundll32.exe"
In the Command Arguments box I type (main is the function to be executed): output.dll, main
In the Working Directory I type: $(SolutionDir)$(Configuration)
Attach -> yes
After following these steps, I try to debug the DLL, but I get this error:
"Unable to attach. Process "C:/Windows/System32\rundll32.exe" is not running on "MY-PC", Refresh the process list before attempting another attach."
Anyone know how to debug a DLL, without manually starting rundll32.exe from command prompt and manually attaching to this process?
You should set:
"Attach -> no"
otherwise the VS is not trying to start new rundll32.exe process.
Setting Attach -> yes tells VS to attach to existing process.