投稿

MSbuildコマンドをバッチファイルで実行し、ログを出力する(Visual Studio2019 Community)

JenkinsでMSBuildを実行するためにバッチファイルを作成したのでメモしておく。 引数には、「ソリューション構成」を設定。 エラーログを日付を入れたファイルで出力させる。 @echo off rem ログファイルに日付を入れる set dt1=%date:~0,4%%date:~5,2%%date:~8,2% set tm1=%time:~0,2%%time:~3,2%%time:~6,2% set fname1=%dt1%_%tm1% rem set WORK_DIR=%~dp0 set WORK_DIR=F:\svn\trunk pushd %WORK_DIR% rem ログ出力先 set OUTPUTS=%WORK_DIR%\..\publish rem ソリューション構成の設定(引数設定) set CONFIG=%~1 if "%CONFIG%"=="" set CONFIG=Release If not exist %OUTPUTS%\%CONFIG% mkdir -p %OUTPUTS%\%CONFIG% SET MSBuildPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\ SET BuildPath=F:\svn\trunk "%MSBuildPath%\MSBuild.exe" "%BuildPath%\WebMVC.csproj" ^ /t:WebPublish /p:Configuration=%CONFIG% ^ /p:WebPublishMethod=FileSystem ^ /p:publishUrl=%OUTPUTS%\%CONFIG% ^ -fl1 -fl2 -fl3 ^ -flp2:logfile=%OUTPUTS%\JustErrors-%dt1%_%tm1%.log;errorsonly ^ -flp3:logfile=%OUTPUTS%\JustWarnings-%dt1%_%tm1%.log;warningsonly if %errorlevel% neq 0 ( ech...

CentOS7 on VagrantにSubversionをインストール

 やった手順を書こうと思ったが、このサイトの通り1ミリも違いがないので、このサイトを忘れないようにリンクだけ貼っとく。 (参考サイト) VMwareのCentOSをSVNサーバにして、開発環境のバージョン管理用に構築してみた svn command line tool  【svn】基本コマンド  

postman + newman + jenkins on Windows10

イメージ
 webapiをpostmanとnewmanを使ってテストし、Jenkinsで自動化できるか確認した。  newmanのコマンドは、以下の通り。 F:\etc>newman run gettest.postman_collection.json -e local.postman_environment.json newman gettest → getValues-0   GET http://localhost:64587/api/values?id=0 [304 Not Modified, 295B, 106ms]   1. Status code is 200 → getValues-1   GET http://localhost:64587/api/values?id=1 [200 OK, 358B, 7ms]   √  Status code is 200 → postValues-title-ok   POST http://localhost:64587/api/values [200 OK, 355B, 8ms]   √  Status code is 200 → postValues-title-non   POST http://localhost:64587/api/values [304 Not Modified, 295B, 44ms]   2. Status code is 200 ┌─────────────────────────┬───────────────────┬──────────────────┐ │                         │          executed │       ...

.Net FrameworkをIISで動かそうとすると404エラーが発生する

イメージ
理由が全然わからなかったが、このサイト( WCF サービスで HTTP 404.17 エラー )を見つけてやっと解決したのでメモしておく。 Windows10環境では以下のように「Windowsの機能の有効化」で「HTTPアクティブ化」にチェックを入れる。 これでOK。

web.configにNlog設定を踏襲し、変換構文を使ってソリューション構成ごとに異なるログ設定をする

アクション 最初に以下を宣言する。 これで、ソースコードにはログを貼るだけでよくなる。   <configSections>     <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>   </configSections> あとは、targetとruleを付けるだけ。 全体像は以下の通り。 Web.config <configuration>   <configSections>     <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>   </configSections>   <nlog>     <targets>       <target name="logFile" type="File" fileName="./logs/${shortdate}-debug.log" encoding="UTF-8"         archiveFileName="${basedir}/logs/archives/archive.${shortdate}-debug.log" archiveEvery="Day" archiveNumbering="Rolling" maxArchiveFiles="365"         layout="${longdate},${uppercase:${level}},${callsite},${callsite-linenumber},${message}"/>       <!--       <target name=...

シンプルにMSbuildコマンドを使う(Visual Studio2019 Community)

MSBuildを使ってビルドしたのでメモる。 ■ MSBuildのパスは以下の通り。 ↓をWindowsの環境変数に登録する。 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin ■ Release Build msbuild /p:Configuration=Release /t:Rebuild     ■ Publish Build SET MSBuildPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\ SET BuildPath=F:\work\DotNetFramework\WebMVC   "%MSBuildPath%\MSBuild.exe" "%BuildPath%\WebMVC.csproj" /t:Build /p:DeployOnBuild=true /p:Configuration=Release /p:TargetFramework=v4.7.2 /p:PublishProfile=FolderProfile /p:RestorePackages=false /p:SkipPostSharp=true   Publish Build の出力先 \WebMVC\Properties\PublishProfiles \ FolderProfile.pubxml を確認すると、 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">   <PropertyGroup>     <DeleteExistingFiles>False</DeleteExistingFiles>     <ExcludeApp_Data>False</ExcludeApp_Data...

ソリューション構成ごとにconfigファイルを作成する

イメージ
.NetFrameworkのソリューション構成ごとにweb.configを作成し、そのconfigファイルの内容を反映させる。 ちょっと、つまずいたのでメモしておく。 (アクション) 1. 新しいソリューション構成を作成する。 2. web.configを作成する。 3. 変換構文の作成 4. .csprojファイルの編集 1. 新しいソリューション構成の作成 Visual Studioの「ビルド」→「構成マネージャー」→「アクティブソリューション構成」→「新規作成」 で、新しいソリューション構成を作成する。 2. web.configの作成 Web.configを右クリックして「Config変換を追加」をクリックすると、先ほど追加した新しいソリューション構成のWeb.configが追加される。 3. 変換構文の作成 前回のブログ を参考に作成する。 <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">     <connectionStrings>         <add name="ConnectionString"           connectionString="Data Source=192.168.44.10.1\SQLEXPRESS;Initial Catalog=AWS_DB;;Connect Timeout=60;Persist Security Info=False; User ID=hoge;Password=1234"           xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>     </connectionStrings>     <appSettings>      ...