setlocal

set WIX_PATH=C:\Program Files (x86)\WiX Toolset v3.6\bin
set OUTPUT=fooeditor_setup.msi
set TYPE=%1
set IDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE

if "%1"=="" set TYPE=Release

md ..\FooEditor\bin\x86\%TYPE%\Plugin

"%IDE_PATH%\devenv" /build %TYPE% ..\FooEditor.sln
"%IDE_PATH%\devenv" /build %TYPE% ..\FooGrep.sln
"%IDE_PATH%\devenv" /build %TYPE% ..\Plugins.sln

md dist
xcopy ..\Libs\Keywords .\dist\Keywords /E /I
xcopy ..\Libs\Sinppets .\dist\Sinppets /E /I
copy ..\Libs\*.xsd .\dist
copy ..\FooEditor\bin\x86\%TYPE%\*.* .\dist
copy ..\FooGrep\bin\%TYPE%\*.* .\dist
copy ..\FooEditorHelp\*.chm .\dist
copy ..\AdminOperation\bin\%TYPE%\*.exe .\dist

md dist\Plugin
copy ..\FooEditor\bin\x86\%TYPE%\Plugin\*.* .\dist\Plugin

"%WIX_PATH%\candle.exe" installer.xml
"%WIX_PATH%\light.exe" -cultures:ja-jp -ext WiXNetFxExtension -ext WixUIExtension installer.wixobj -out "%OUTPUT%"

endlocal
pause

