|
I just found out that the download URL of prerequisites are written directly to the generated SETUP.EXE!
In my previous post, I found the solution to dynamically modify the URL in .application files. But I also want tell SETUP.EXE to download from a URL that is only determined after Publish Wizard runs.
But I know modifying Windows PE file is evil. Is there still a workaround?
Thanks!
|
| Neo the 1 Tuesday, November 08, 2005 12:02 PM |
Phew~~~ At last! I found the solution myself (again).
It seems I only need to create TaskItem with ProductCode found in product.xml files located in C:\Program Files\Microsoft.NET\SDK\v2.0\Bootstrapper\Packages.
That's easy. So I want to share my experience with others who might have same problem as me.
Enjoy!
Imports System Imports System.Security.Cryptography Imports System.Security.Cryptography.Xml Imports System.Security.Cryptography.X509Certificates Imports System.Text Imports System.Xml Imports Microsoft.Win32 Imports Microsoft.Build.Tasks.Deployment.ManifestUtilities Imports Microsoft.Build.Tasks.Deployment.Bootstrapper Imports Microsoft.Build.Tasks Imports Microsoft.Build.Framework Imports Microsoft.Build.Utilities
Module Module1
Sub Main() Dim x As New GenerateBootstrapper Dim item1 As TaskItem Dim item2 As TaskItem Dim item3 As TaskItem Dim item4 As TaskItem
Try
x.ApplicationName = "test" x.ApplicationUrl = "http://localhost" x.ApplicationFile = "app.exe" item1 = New TaskItem("Microsoft.JSharp.2.0") item2 = New TaskItem("Microsoft.Net.Framework.2.0") item3 = New TaskItem("Microsoft.Visual.C++.8.0.x86") item4 = New TaskItem("Microsoft.Data.Access.Components.2.8") x.BootstrapperItems = New TaskItem() {item1, item2, item3, item4} x.Path = "c:\temp\bootstrapfiles" x.ComponentsLocation = ComponentsLocation.Relative x.ComponentsUrl = "http://localhost" x.CopyComponents = True 'x.OutputPath = "c:\temp" x.Execute() Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub End Module
|
| Neo the 1 Wednesday, November 09, 2005 9:31 AM |
I founnd a class GenerateBootstrapper in Microsoft.Build.Tasks namespace. I think this is the right one that does the job of creating bootstrap SETUP.EXE. But I don't know how to do with it. Can anyone help? |
| Neo the 1 Tuesday, November 08, 2005 1:54 PM |
After reading the docs, I wrote the following code to generate a simple bootstrap SETUPE.EXE. That's fine. But I don't know how to include the Framework and Crystal Reports and other components.
Imports System Imports System.Security.Cryptography Imports System.Security.Cryptography.Xml Imports System.Security.Cryptography.X509Certificates Imports System.Text Imports System.Xml Imports Microsoft.Win32 Imports Microsoft.Build.Tasks.Deployment.ManifestUtilities Imports Microsoft.Build.Tasks Imports Microsoft.Build.Framework Imports Microsoft.Build.Utilities
Module Module1
Sub Main() Try Dim x As New GenerateBootstrapper
x.ApplicationName = "test" x.ApplicationUrl = "http://localhost" x.ApplicationFile = "app.exe" x.BootstrapperItems = New TaskItem() {} x.ComponentsLocation = "HomeSite" x.ComponentsUrl = "http://localhost" x.CopyComponents = True x.OutputPath = "d:\temp" x.Execute() Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub End Module
|
| Neo the 1 Tuesday, November 08, 2005 2:09 PM |
You actually have two options... You can change the URL's in a built Setup.Exe from the command line using the -url or -componentsurl options. If you are trying to build your own bootstrapper, I would recommend using MSBuild instead of trying to use the DTE interfaces. MSBuild is easier and doesn't require Visual Studio to be installed, just the .NET Frameworks SDK. I've built a tool that makes it pretty easy to do this at: http://www.gotdotnet.com/workspaces/workspace.aspx?id=ddb4f08c-7d7c-4f44-a009-ea19fc812545 However, here's a sample Bootstrapper MSBuild Project if you want to build it yourself.: <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <BootstrapperFile Include="Microsoft.Net.Framework.2.0"> <ProductName>.NET Framework 2.0</ProductName> </BootstrapperFile> <BootstrapperFile Include="Microsoft.Sql.Server.Express.1.0"> <ProductName>SQL Server 2005 Express Edition</ProductName> </BootstrapperFile> </ItemGroup> <Target Name="Bootstrapper"> <GenerateBootstrapper ApplicationFile="CyclesRUsInstaller.msi" ApplicationName="Test Build" ApplicationUrl="http://mywebsite.com/applicationfolder" BootstrapperItems="@(BootstrapperFile)" ComponentsLocation="Relative" Culture="en" FallbackCulture="en-US" CopyComponents="True" Validate="False" OutputPath="D:\Documents and Settings\VBLAB2\Desktop\BuildTesting" /> </Target> </Project> |
| David Guyer MSFT Tuesday, November 08, 2005 5:28 PM |
Thanks for David's reply. But that is not exactly what I need.
My code in the above post does run without Visual Studio and the SDK (except I have to copy files under C:\Program Files\Microsoft.NET\SDK\v2.0\Bootstrapper and set x.Path appropriately).
Now I think my problem turns into this:
How do I tell GenerateBootstrapper to generate a SETUP.EXE that automatically downloads the Framework and Crystal Reports and possible other components, just like Visual Studio Publilsh Wizard does?
I thin I need to set BootstrapperItems property, But I don't have any idea how to set it. What are the metadata and where can I find the docs about them?
Thanks!
|
| Neo the 1 Wednesday, November 09, 2005 6:14 AM |
Phew~~~ At last! I found the solution myself (again).
It seems I only need to create TaskItem with ProductCode found in product.xml files located in C:\Program Files\Microsoft.NET\SDK\v2.0\Bootstrapper\Packages.
That's easy. So I want to share my experience with others who might have same problem as me.
Enjoy!
Imports System Imports System.Security.Cryptography Imports System.Security.Cryptography.Xml Imports System.Security.Cryptography.X509Certificates Imports System.Text Imports System.Xml Imports Microsoft.Win32 Imports Microsoft.Build.Tasks.Deployment.ManifestUtilities Imports Microsoft.Build.Tasks.Deployment.Bootstrapper Imports Microsoft.Build.Tasks Imports Microsoft.Build.Framework Imports Microsoft.Build.Utilities
Module Module1
Sub Main() Dim x As New GenerateBootstrapper Dim item1 As TaskItem Dim item2 As TaskItem Dim item3 As TaskItem Dim item4 As TaskItem
Try
x.ApplicationName = "test" x.ApplicationUrl = "http://localhost" x.ApplicationFile = "app.exe" item1 = New TaskItem("Microsoft.JSharp.2.0") item2 = New TaskItem("Microsoft.Net.Framework.2.0") item3 = New TaskItem("Microsoft.Visual.C++.8.0.x86") item4 = New TaskItem("Microsoft.Data.Access.Components.2.8") x.BootstrapperItems = New TaskItem() {item1, item2, item3, item4} x.Path = "c:\temp\bootstrapfiles" x.ComponentsLocation = ComponentsLocation.Relative x.ComponentsUrl = "http://localhost" x.CopyComponents = True 'x.OutputPath = "c:\temp" x.Execute() Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub End Module
|
| Neo the 1 Wednesday, November 09, 2005 9:31 AM |
Thanks for your support on this. I could NOT find any code or documentation about this anywhere.
I converted your code to c#, and it seems to compile. The error i get is when I execute(), it cannot find any of the task items.
x. path ="c:\\temp\\bootstrapper\\";
Task attempted to log before it was initialized. Message was: Item 'Microsoft.Net.Framework.2.0' could not be located in 'c:\temp\bootstrapper\'.
I copied the directories located in the SDK\Bootstrapper folder to this location.
Am I missing something? |
| Massimo Galati Friday, February 17, 2006 8:48 PM |
So I managed to figure out what else I needed.
For those of you who are struggling with this. You need to ensure that if you change the path variable, you must create a Packages Folder as well.
so if x.path="c:\\temp\\bootstrapper\\" Your Packages must be in a folder named Packages underneath c:\temp\bootstrapper
You must also include the Engine Folder and its contents so that it can determine language and Engine settings |
| Massimo Galati Friday, February 17, 2006 9:15 PM |
More info on the bootstrapper files (after so long time).
Actually, you need to copy files from C:\Program Files\Microsoft.NET\SDK\v2.0\Bootstrapper assuming the SDK is installed on drive C:.
|
| Neo the 1 Monday, February 20, 2006 8:09 AM |
Hi all,
For VS 2008 I have some problems.
I could not use the standard way with MSBUILD so I'm using the API like you.
Code Snippet item1 = New TaskItem("BusinessObjects.CrystalReports.10.5") item2 = New TaskItem("Microsoft.Net.Framework.2.0") item3 = New TaskItem("Microsoft.Net.Framework.3.5") item4 = New TaskItem("Microsoft.Windows.Installer.3.1")
I useC#.
Microsoft.Net.Framework.3.5 contain Microsoft.Net.Framework.2.0 so I must not have both.
But BusinessObjects.CrystalReports.10.5 need Microsoft.Net.Framework.2.0 and complain when I do not add Microsoft.Net.Framework.2.0.
I have no idea what to do. It's like I cannot have BusinessObjects.CrystalReports.10.5 if I use Microsoft.Net.Framework.3.5. Very weird. Because all this was working with VS 2005 using the MSBUILD command.
I had this problem when I migrated to VS 2008. The path in the GenerateBootstrapper is not good. It is like MSBUILD do not have the right Path either.
I need help on this.
Thank you very much. |
| Bernybon Tuesday, January 22, 2008 11:58 PM |
Hey Neo,
I'm basically looking to do the same thing, modify the setup.exe bootstrapper that is generated with the ClickOnce publish operation to point to a different URL. In my case pregenerating specialized setup.exe bootstrappers is not an option becaues this product will be deployed to several different servers and maintained separately.
At first I looked into using the setup.exe -url command line argument to update the URL which almost works but doesn't seem to work from an automated process such as a web application, script, or windows service because it prompts the user when the command is run.
I'm still hoping that maybe there is a way of reading in an existing bootstrapper and then generating another one based off of the original or something along those lines. This is similar to how the DeployManifest works under Microsoft.Build.Tasks.Deployment.ManifestUtilities and it is very handy. |
| kainhart Tuesday, March 10, 2009 7:56 PM |