I know this is more a workaround than a proper solution, but instead of specifying (and then connecting to from your application) a certain TCP port, you can instead enable the SQL Browser service during the silent installation of SQL Server. This will enable your app to connect to the instance you're interested based on the Instance Name, not the TCP port.
It may have a performance penalty on creating a new connection, since an additional network round-trip is needed for the client to acquire the port for the Instance, but (a) for client-server apps with long-living connections it won't be a problem, and (b) for app-server apps with connection pooling, a well-configured pool won't be affected much (I think), or it may need slightly more connections to achieve the same performance.
An additional advantage is that you can have more than one SQL Server instance on the same host and not care about ports. For example, in your (and mine) silent installation scenario, you would have to first check whether the port you want is used by another instance. Using the SQL Browser removes the need for this logic in your installation.