0

我想加密我的连接字符串和应用程序设置。目前,我有多个发布配置文件,每个配置文件都有它的转换。

Below is my pubxml file code but for some reason my target with exec command is not getting triggered. Can some one familiar with the subject matter please help!! 

先感谢您。

<project toolsversion="4.0" xmlns="http://schemas.microsoft.co...">
    <propertygroup>
    <webpublishmethod>FileSystem</webpublishmethod>
    <lastusedbuildconfiguration>Release</lastusedbuildconfiguration>
    <lastusedplatform>Any CPU</lastusedplatform>
    <siteurltolaunchafterpublish/>
    <launchsiteafterpublish>True</launchsiteafterpublish>
    <excludeapp_data>False</excludeapp_data>
    <publishurl>e:\Test_Deployment</publishurl>
    <deleteexistingfiles>False</deleteexistingfiles>
    <msdeployenablewebconfigencryptrule>true</msdeployenablewebconfigencryptrule>

    </propertygroup>
    <target name="CustomPostPublishActions" aftertargets="MSDeployPublish">
    <exec command="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pe appSettings -app $(publishUrl)/MyProj"/>
    <exec command="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pef connectionStrings $(publishUrl) -prov MyProviderKey"/>
    </target>

    </project>
4

1 回答 1

0

如果您无法做到这一点,您可以尝试以下步骤:

1-创建一个新的构建配置(在调试/发布菜单下转到配置管理器..然后在配置列上创建一个新配置)。

2- 在构建后事件(项目属性 > 构建事件 > 构建后事件命令行)上添加如下内容:

if "$(ConfigurationName)" == "MyNewBuildConfiguration"(
execute commands in here
)

3-更新您的配置文件以使用此构建配置。

希望这可以帮助。

于 2017-11-28T18:32:41.133 回答