2023年1月18日 星期三

ReplacableToken_SQL_SERVER_CONNECTION-Web.config Connection String_0

 在使用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'" 

 

簽署時發生錯誤: 無法簽署 bin\Debug\app.publish\XXX.exe。SignTool Error: No certificates were found that met all the given criteria.

 這是一個程式碼簽署憑證的問題。當您的專案設定要進行程式碼簽署,但系統找不到合適的憑證時就會出現這個錯誤。以下是幾種解決方法: 方法 1:移除程式碼簽署設定 如果您不需要程式碼簽署,可以在專案中移除相關設定: 在 Visual Studio 中右鍵點擊專案 → 屬性 點擊「...