简体   繁体   中英

SharePoint WSP deployment multiple environments and uses SPWebConfigModification

I have SharePoint feature that modifies the web.config (using the SPWebConfigModification class) to add the DB connection string. But this connection string is different for the 3 envrionments I have.

My question is there any way for me to externalize this connection string so that the WSP picks up this connection during deployment? Currently my only options seems to be create WSP Project per environment and generate multiple WSP that do exactly the same thing.

Thanks

Rather than add it to the web.config why don't use use something like the SPFarm.Properties?

SO - Read/Write from/to Hierarchical Object Store - SharePoint

You could then modify/add the connection string after deployment using something like Property Bag Settings

Of course you also want to ensure the connection string is secure - and whilst you should be doing that with web.config its more important in the PropertyBag as its easier for others to view using something like

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM