0

I am using VS2010 and created a program using C#.

I got a WIX installer which is creating sub folders in the application's main folder and is copying files to these folders.

The problem is that when I want to just run the application from VS and debug it, the directories are not created as in my WIX file, but in my code I count on these directories to appear and to access the files there.

How can I make visual studio create the same directory tree of the application when compiling it, like the one created in the installation itself so I can run it and debug it with everything in place?

CodeMonkey
  • 11,196
  • 30
  • 112
  • 203

3 Answers3

0

I also couldn't debug in Visual Studio the projects made with Wix.

I found a free and efficient developing tool- SharpDevelop, that allows to compile and debug the WIX projects.

Here is the link for downloading it.

Hope this helps!

user3165438
  • 2,631
  • 7
  • 34
  • 54
  • I don't need to debug the installation and what wix is doing. I need that Visual Studio will create the same directories in compilation as I create in Wix when the application is installed so i can run it from the visual studio – CodeMonkey Sep 09 '14 at 11:02
  • @YonatanNir, May there is an extension for VS for this purpose. Please notify me when you get a solution. Thanks. – user3165438 Sep 09 '14 at 13:16
0

You need to set execute your custom action after your files are installed, like this:

<InstallExecuteSequence>
  <Custom Action="MyAction" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>

You can use before InstalFinalize too. Then in your custom C# action write this:

Debugger.Launch();

Now run your installer and when your custom action reaches this line, it will ask you to debug and start VS.

Aaron
  • 826
  • 10
  • 22
  • I don't need to debug the installation. I need that Visual Studio will create the same directories in compilation as I create in Wix when the application is installed so i can run it from the visual studio – CodeMonkey Sep 09 '14 at 11:01
  • AFAIK VS can't do that and I don't really get why you would want that. Why not let the installer create the files/folders, debug your code and the rollback/uninstall the program? That's how I do it. – Aaron Sep 09 '14 at 11:08
  • how will I debug it? by adding the Debugger.Launch() line every single time i want to debug and then uninstall and reinstall it every time? I want to be able to debug it like anything else - by clicking the play button and simply start debugging – CodeMonkey Sep 09 '14 at 11:14
  • That's how you need to do it yes. You can't debug like a console application, you need the Session parameter and such. – Aaron Sep 09 '14 at 11:25
0

The way I solved it (and if you got a better solution I'll be happy to share it) was going to the main project's properties and add some post build events which copied the files the way they should. That way I can debug without the need of using the Debugger.Launch(); line

CodeMonkey
  • 11,196
  • 30
  • 112
  • 203