Archive for the ‘Deployment’ Category

An error occurred while validating. HRESULT = ‘80004005′

An error occurred while validating. HRESULT = ‘80004005′, this error just came up when I’m trying to organize my .Net Project files in my Solution, I removed some of the projects and just use the compiled dll in referencing to the main Project. However, this error has appeared during rebuilding the setup project and it took some of my time to find the solution or the cause.

So, what I did was I removed all References from the Target Primary Output project and added them and rebuilding it again , :) that’s it no more errors.


“Thank you for reporting this issue. We were able to reproduce the problem and have identified the root cause. The problem is caused by cross-solution project reference between Solution1 and Solution2. From the attached project, the project “WindowsFormApplication1” in Solution2 references a project that is not in Solution2 (it references ClassLibrary1 from Solution1). To fix the error, the workaround is to copy the ClassLibrary1 project to Solution2 and re-add the reference to ClassLibrary1 within its own solution.


Project-to-project references only works within the same solution. If you have to split into two solutions and split the code for your class library into two projects, you need to also split the project that references the class library into two projects (one for each solution) in order to avoid project references outside the current solution.

I hope this helps.

Candy Chiang
Program Manager – Visual Studio”

For more information and explanation about this error just click here

, , ,

No Comments


Error 1001. Exception occurred while initializing the installation. System.IO.FileNotFoundException


This error occurs when the CustomActionData has a supplied value,

Example:

The value of the CustomActionData is /TARGETDIR=[TARGETDIR], what you need to do is to update it to /TARGETDIR=”[TARGETDIR]\”

, ,

No Comments


How to get msi setup file location using installer class

To get the current msi setup path,

  1. Goto the setup project
  2. Right click and select view->custom actions
  3. Under Install Node, click the “primary output from….”
  4. Press F4 to show its property
  5. Add the /Source=[SourceDir] to the CustomActionData property
  6. Can then be access through the installer class

Context.Parameters(”Source”)

Source Path Custom Action

Source Path Custom Action


, , ,

No Comments


The install location for prerequisites has not been set to

Follow this steps to solve this problem:
Update the Package Data

  1. Open the [Program Files]\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1 folder or %ProgramFiles(x86)%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1 on x64 operating systems
  2. Edit the Product.xml file in Notepad.
  3. Paste the following into the < PackageFiles > element:
  4. Find the element for < PackageFile Name=”dotNetFX30\XPSEPSC-x86-en-US.exe” and change the PublicKey value to:
    3082010A0282010100A2DB0A8DCFC2C1499BCDAA3A34AD23596BDB6CBE2122B79
    4C8EAAEBFC6D526C232118BBCDA5D2CFB36561E152BAE8F0DDD14A36E284C7F163
    F41AC8D40B146880DD98194AD9706D05744765CEAF1FC0EE27F74A333CB74E5EFE
    361A17E03B745FFD53E12D5B0CA5E0DD07BF2B7130DFC606A2885758CB7ADBC85E
    817B490BEF516B6625DED11DF3AEE215B8BAF8073C345E3958977609BE7AD77C13
    78D33142F13DB62C9AE1AA94F9867ADD420393071E08D6746E2C61CF40D5074412
    FE805246A216B49B092C4B239C742A56D5C184AAB8FD78E833E780A47D8A4B2842
    3C3E2F27B66B14A74BD26414B9C6114604E30C882F3D00B707CEE554D77D208557
    6810203010001
  5. Find the element for < PackageFile Name=”dotNetFX30\XPSEPSC-amd64-en-US.exe” and change the PublicKey value to the same as in step 4 above
  6. Save the product.xml file

Download and Extract the Core Installation Files

  1. Navigate to the following URL: http://go.microsoft.com/fwlink?LinkID=118080
  2. Download the dotNetFx35.exe file to your local disk.
  3. Open a Command Prompt window and change to the directory to which you downloaded dotNetFx35.exe.
  4. At the command prompt, type:

dotNetFx35.exe /x:.

This will extract the Framework files to a folder named “WCU” in the current directory.
Copy the contents of the WCU\dotNetFramework folder and paste them in the %Program Files%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1 folder (%ProgramFiles(x86)%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1 on x64 operating systems).

Note: Do not copy the WCU\dotNetFramework folder itself. There should be 5 folders under the WCU folder, and each of these should now appear in the DotNetFx35SP1 folder. The folder structure should resemble the following: DotNetFx35SP1 (folder)

    • dotNetFX20 (folder
    • dotNetFX30 (folder)
    • dotNetFX35 (folder)
    • dotNetMSP (folder)
    • TOOLS folder)
    • en (or some other localized folder)
    • dotNetFx35setup.exe (file)

You may now delete the files and folders you downloaded and extracted in steps 2 and 4.

You can read more on the attached readme file.

VS 2008 SP1 Readme

, , , ,

No Comments


How to change application setting during installation in .net

Follow this thread for the details of required steps to accomplish this problem.

No Comments


How to Create Installer for Windows Service Project

To create a setup project for your service

  1. In Solution Explorer, right-click to select your solution, point to Add, and then click New Project.
  2. In the Project Types pane, select the Setup and Deployment Projects folder.
  3. In the Templates pane, select Setup Project. Name the project MyServiceSetup. Click OK.

    A setup project is added to the solution.

Next you will add the output from the Windows service project, MyNewService.exe, to the setup.

To add MyNewService.exe to the setup project

  1. In Solution Explorer, right-click MyServiceSetup, point to Add, then choose Project Output.

    The Add Project Output Group dialog box appears.

  2. MyNewService is selected in the Project box.
  3. From the list box, select Primary Output, and click OK.

    A project item for the primary output of MyNewService is added to the setup project.

Now add a custom action to install the MyNewService.exe file.

To add a custom action to the setup project

  1. In Solution Explorer, right-click the setup project, point to View, and then click Custom Actions.

    The Custom Actions editor appears.

  2. In the Custom Actions editor, right-click the Custom Actions node and choose Add Custom Action.

    The Select Item in Project dialog box appears.

  3. Double-click the Application Folder in the list box to open it, select Primary Output from MyNewService (Active), and click OK.

    The primary output is added to all four nodes of the custom actions — Install, Commit, Rollback, and Uninstall.

  4. In Solution Explorer, right-click the MyServiceSetup project and click Build.

, ,

No Comments


How to Deploy and Execute SQL Script

 

 

Source: Deploy SQL Databases Easily with the Installer Class

, ,

No Comments


How to Create Uninstall

Introduction

It’s super easy to add this to your deployment project.

  1. Select your deployment project and go to the file system editor, user programs menu.
  2. Add an additional shortcut to your primary output project and name it Uninstall Application.
  3. Set the Arguments property to /u=[ProductCode].
  4. Add the following code to your project’s Main() sub or startup form’s New() sub just before the call to InitializeComponent().

Dim arguments As String() = Environment.GetCommandLineArgs()
Dim argument As String

For Each argument In arguments

If argument.Split(”=”)(0).ToLower = “/u” Then

Dim guid As String = argument.Split(”=”)(1)
Dim path As String = _
Environment.GetFolderPath(Environment.SpecialFolder.System)
Dim si As New ProcessStartInfo(path & _
“\msiexec.exe”, “/i ” & guid)
Process.Start(si)
Close()
Application.Exit()
End
End If

Next

That’s is! The Deployment project will replace [ProductCode] in the Arguments property with the actual installer project’s ProductCode GUID value. Your program will see the /u={Actual ProductCode} argument and pass it to msiexec.exe before exiting.

The installer is run in repair/remove mode for your application. The user is allowed to select repair or remove, and continue. If you want the product to remove only, replace the “/i ” with “/x “.

 

Source: http://www.codeproject.com/KB/install/DeployUninstall.aspx

, ,

No Comments


How to Debug Installer Class

To Debug Install Class;

Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)

#If DEBUG Then

        System.Diagnostics.Debugger.Break()

#End If

        MyBase.Install(stateSaver)

End Sub

 

, ,

No Comments


Using a Custom Action to Create a Database During Installation

he following walkthrough demonstrates the use of a custom action and the CustomActionData property to create a database and database table during installation.
Note This walkthrough requires SQL Server on the computer where you will deploy the application.

To create an installer class
On the File menu, point to New, and then choose Project.
In the New Project dialog box, select Visual Basic Projects in the Project Type pane, and then choose Class Library in the Templates pane. In the Name box, type DBCustomAction.
Click OK to close the dialog box.
On the Project menu, choose Add New Item.
In the Add New Item dialog box, choose Installer Class. In the Name box, type DBCustomAction.
Click OK to close the dialog box.

To create a data connection object
In Server Explorer, select Data Connections. Right-click and choose Add Connection.
In the Data Link Properties dialog box, do the following:
Enter the server name.
Select Use Windows NT Integrated Security.
In the database box, type master.
Click OK to close the dialog box.
Drag the new connection and drop it on the DBCustomAction.vb designer to create a sqlConnection1 object.

To create a text file that contains a SQL statement to create a database
In Solution Explorer, select the DBCustomAction project. On the Project menu, choose Add New Item.
In the Add New Item dialog box, choose Text File. In the Name box, type sql.txt (must be in lower case).
Click OK to close the dialog box.
Add the following to the sql.txt file:
CREATE TABLE [dbo].[Employees] (
[Name] [char] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Rsvp] [int] NULL ,
[Requests] [nvarchar] (4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY];

ALTER TABLE [dbo].[Employees] WITH NOCHECK ADD
CONSTRAINT [PK_Employees] PRIMARY KEY CLUSTERED
(
[Name]
) ON [PRIMARY];
In Solution Explorer, select sql.txt. In the Properties window, set the BuildAction property to Embedded Resource.

To add code to the installer class to read the text file
In Solution Explorer, select DBCustomAction.vb. On the View menu, choose Code.
Add the following Imports statement at the top of the module:
Imports System.IO
Imports System.Reflection
Add the following code to the class:
Private Function GetSql(ByVal Name As String) As String
Try

‘ Gets the current assembly.
Dim Asm As [Assembly] = [Assembly].GetExecutingAssembly()

‘ Resources are named using a fully qualified name.
Dim strm As Stream = Asm.GetManifestResourceStream(Asm.GetName().Name + “.” + Name)

‘ Reads the contents of the embedded file.
Dim reader As StreamReader = New StreamReader(strm)
Return reader.ReadToEnd()
Catch ex As Exception
MsgBox(”In GetSQL: ” & ex.Message)
Throw ex
End Try

End Function

Private Sub ExecuteSql(ByVal DatabaseName As String, ByVal Sql As String)
Dim Command As New SqlClient.SqlCommand(Sql, sqlConnection1)

Command.Connection.Open()
Command.Connection.ChangeDatabase(DatabaseName)
Try
Command.ExecuteNonQuery()
Finally
‘ Finally, blocks are a great way to ensure that the connection
‘ is always closed.
Command.Connection.Close()
End Try
End Sub

Protected Sub AddDBTable(ByVal strDBName As String)
Try
‘ Creates the database.
ExecuteSql(”master”, “CREATE DATABASE ” + strDBName)

‘ Creates the tables.
ExecuteSql(strDBName, GetSql(”sql.txt”))

Catch ex As Exception
‘ Reports any errors and abort.
MsgBox(”In exception handler: ” & ex.Message)
Throw ex
End Try
End Sub

Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)
MyBase.Install(stateSaver)
AddDBTable(Me.Context.Parameters.Item(”dbname”))
End Sub
On the Build menu, choose Build DBCustomAction.

To create a deployment project
On the File menu, choose Add Project, New Project.
In the Add Project dialog box, select Setup and Deployment Projects in the Project Type pane, and then choose Setup Project in the Templates pane. In the Name box, type DBCustomAction Installer.
Click OK to close the dialog box.
In the Properties window, select the ProductName property and type DB Installer.
In the File System Editor, select the Application Folder. On the Action menu, choose Add, Project Output.
In the Add Project Output Group dialog box, select the primary output for the DBCustomAction project. Click OK to close the dialog box.

To create a custom installation dialog
Select the DBCustomAction Installer project in Solution Explorer. On the View menu, point to Editor, and choose User Interface.
In the User Interface Editor, select the Start node under Install. On the Action menu, choose Add Dialog.
In the Add Dialog dialog box, select the Textboxes (A) dialog, then click OK to close the dialog box.
On the Action menu, choose Move Up. Repeat until the Textboxes (A) dialog is above the Installation Folder node.
In the Properties window, select the BannerText property and type Specify Database Name.
Select the BodyText property and type This dialog allows you to specify the name of the database to be created on the database server.
Select the Edit1Label property and type Name of DB:.
Select the Edit1Property property and type CUSTOMTEXTA1.
Select the Edit2Visible, Edit3Visible, and Edit4Visible properties and set them to false.

To create a custom action
Select the DBCustomAction Installer project in Solution Explorer. On the View menu, point to Editor, and choose Custom Actions.
In the Custom Actions Editor, select the Install node. On the Action menu, choose Add Custom Action.
In the Select item in project dialog box, double-click the Application Folder.
Select the Primary output from DBCustomAction(Active) item, then click OK to close the dialog box.
In the Properties window, select the CustomActionData property and type /dbname=[CUSTOMTEXTA1].
On the Build menu, choose Build DBCustomActionInstaller.

To install on your development computer
Select the DBCustomAction Installer project in Solution Explorer. On the Project menu, choose Install.

This will run the installer on your development computer.
Note You must have install permissions on the computer in order to run the installer.

To deploy to another computer
In Windows Explorer, navigate to your project directory and find the built installer. The default path will be \documents and settings\yourloginname\DBCustomAction Installer\project configuration\DBCustomAction Installer.msi. The default project configuration is Debug.
Copy the DBCustomAction Installer.msi file and all other files and subdirectories in the directory to another computer.
Note To install on a computer that is not on a network, copy the files to traditional media such as CD-ROM.

On the target computer, double-click the Setup.exe file to run the installer.
Note You must have install permissions on the computer in order to run the installer.

To uninstall the application
In the Windows Control Panel, double-click Add/Remove Programs.
In the Add/Remove Programs dialog box, select DBCustomAction Installer and click Remove, then click OK to close the dialog box.
Tip To uninstall from your development computer, on the Project menu, choose Uninstall.

Source: http://msdn.microsoft.com/en-us/library/49b92ztk(vs.71).aspx

http://www.codeguru.com/Csharp/.NET/net_security/encryption/article.php/c9601/

, ,

No Comments



SetPageWidth