Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Problem with release mode of setup project
 

Problem with release mode of setup project

Hi I have created a setup project that involves quite alot of code. I have overriden the OnAfterUninstall method of the installer class. In this method I have the following code:

protected override void OnAfterUninstall(System.Collections.IDictionary savedState)

{

base.OnAfterUninstall(savedState);

#if DEBUG

System.Windows.Forms.MessageBox.Show("DEBUG");

#else

System.Windows.Forms.MessageBox.Show("RELEASE");

#endif

}

I build my project in Debug mode and again in Release mode. I then build the setup project in Debug mode and then in Release mode. I then Install my project in Debug mode and then uninstall. As expected when I uninstall I get a message box saying 'DEBUG'. Now when I Install my project in Release mode and then uninstall it I get a message box saying 'DEBUG' and not 'RELEASE'. The Primary output ptoject configurationis set as Active. I changed this to Release Any CPU and this did not make any difference.

I then setup a very simple setup project for a windows form and set the Primary output configuration to Active and only implemented the OnAfterUninstall method with the same code as above. When I installed then uninstalled the setup for this simple application in Debug mode the message box appeared saying 'DEBUG'. Then when I install and uninstall in Release mode the message box says 'RELEASE'.

Can anyone help me with this problem please?

Lucy

IT_Graduate  Monday, April 28, 2008 10:31 AM

I have solved my own problem!

After a long time trying to save the savedState object to the projects settings and trying to debug through the code, I some how manage to crash the whole thing. I currently have it installed but I cannot uninstall it as it throughs many errors! So decided to start a new project again by just copying the code needed!

Whilst doing this I knew that in my Setup project I need to add the projects dll to the GAC when it is installed.To do thisI go to the setups File System Editor. I then select from the 'Add Special Folder' menu, 'Global Assembly Cache Folder'. From this folder I then went to 'Add' -> 'Assembly'. This brings up the 'Select Component' dialog. Under the browse tab I then browsed to my dll which was under:

C:\My Documents\Visual Studio 2005\Projects\SharePoint\SharePoint\bin\Debug !

That is when it clicked!

When I want to uninstall my project it is getting the dll from the GAC and this is the debug dll! I then changed this by adding the Primary output from <ProjectName> (Active). Now when my project is uninstalled in debug mode I get the message box saying 'DEBUG' and in release mode the message box says 'RELEASE'!

Lucy

IT_Graduate  Tuesday, April 29, 2008 1:49 PM

Whilst in debug mode I set a breakpoint at the begining of the above event. When this breakpoint was hit I looked at the savedState object and it says that it is null. I think this is my problem. Does anyone know why it is null as I do not think it should be.

When I do the same in my simple test installer the savedState object is not null.

Anyone any ideas please?

Lucy

IT_Graduate  Tuesday, April 29, 2008 8:36 AM

I have solved my own problem!

After a long time trying to save the savedState object to the projects settings and trying to debug through the code, I some how manage to crash the whole thing. I currently have it installed but I cannot uninstall it as it throughs many errors! So decided to start a new project again by just copying the code needed!

Whilst doing this I knew that in my Setup project I need to add the projects dll to the GAC when it is installed.To do thisI go to the setups File System Editor. I then select from the 'Add Special Folder' menu, 'Global Assembly Cache Folder'. From this folder I then went to 'Add' -> 'Assembly'. This brings up the 'Select Component' dialog. Under the browse tab I then browsed to my dll which was under:

C:\My Documents\Visual Studio 2005\Projects\SharePoint\SharePoint\bin\Debug !

That is when it clicked!

When I want to uninstall my project it is getting the dll from the GAC and this is the debug dll! I then changed this by adding the Primary output from <ProjectName> (Active). Now when my project is uninstalled in debug mode I get the message box saying 'DEBUG' and in release mode the message box says 'RELEASE'!

Lucy

IT_Graduate  Tuesday, April 29, 2008 1:49 PM

You can use google to search for other answers

Custom Search

More Threads

• Conditional File Association
• Updating trouble...
• Problem running application via http://server/app.exe
• package deployments
• textbox "press Insert" by porogram
• Is there a way to uninstall framework 2.0 beta automatically?
• Problem with the Clickonce Deployment
• checking the existence of database
• Including 3rd party msi file in project setup!
• How to place folder on a perticular location after running the setup