在使用Jenkins 發佈時遇到一個問題就是建置好的web.config 的連線字串,會出現
ReplacableToken_SQL_SERVER_CONNECTION-Web.config Connection String_0
這是網路上的作法
在你的xxx.xml上
的PropertyGroup 加上
<AutoParameterizationWebConfigConnectionStrings>False
</AutoParameterizationWebConfigConnectionStrings>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '**Release**|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<!-- add the following line to avoid ConnectionString tokenization -->
<AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == '**ReleaseCERT**|AnyCPU'">
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<!-- add the following line to avoid ConnectionString tokenization -->
<AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>
</PropertyGroup>
在我的Jenkins 上可以作用的是在
<MSBuild Projects="%(ProjectReference.FullPath)"
Targets="Package"
Properties="Configuration=$(Configuration);Platform=AnyCPU;
AutoParameterizationWebConfigConnectionStrings=False" Condition="'%(ProjectReference.WebProject)'=='True'"
沒有留言:
張貼留言