投稿

SQL ServerでDBを作成しデータをinsertしたメモ

SQLサーバにデータベースを作成してデータを挿入してみた。 これをファイルにして、バッチで実行させてみたい。   -- Create Database IF NOT EXISTS (select * from master..sysdatabases where name='DB_CHK') CREATE DATABASE DB_TEMP COLLATE Japanese_BIN2 GO USE DB_CHK; -- select object_id('Student'); -- create table if object_id('Student') is null CREATE TABLE Student ( StudentGPAID INT NOT NULL IDENTITY(1,1) PRIMARY KEY, GradeYear TINYINT NOT NULL, Semester NVARCHAR(20) NOT NULL, GradeScore DECIMAL(5,2) NULL, GPA CHAR(1) NULL, CompletedFlag BIT NOT NULL DEFAULT (0) ) go -- Auto rollback when happened Error. SET XACT_ABORT ON begin transaction begin try insert into Student ( GradeYear, Semester, GradeScore, GPA, CompletedFlag) values ( 19, '3学期', 1.01, 'A', 1); insert into Student ( GradeYear, Semester, GradeScore, GPA, CompletedFlag) values ( 20, '2学期', 2.02, 'B', 0); insert into Student ( GradeYear, Semester, Gra...

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...