You cannot do this.
The "main function where you create ManagedProject" is executed during the build msi procedure and your custom dialog is hosted by this MSI during install. Any data that you want to pass to the dialog needs to be obtained at run-time (not compile-time) in the dialog itself.
If the data your dialog needs need to be generated at compile time then you need to push it into the MSI property during the build and read from this property when your dialog is instantiated at run time.
The "main function where you create ManagedProject" is executed during the build msi procedure and your custom dialog is hosted by this MSI during install. Any data that you want to pass to the dialog needs to be obtained at run-time (not compile-time) in the dialog itself.
If the data your dialog needs need to be generated at compile time then you need to push it into the MSI property during the build and read from this property when your dialog is instantiated at run time.