From 8fd631dfa6648ebbe65a4ea76f341d9f9a0c690f Mon Sep 17 00:00:00 2001 From: "Denis Kuzmin (reg)" Date: Fri, 7 Apr 2017 18:08:33 +0300 Subject: [PATCH] Fixed build for 64bit platform. + now msbuild-helper is obsolete and was replaced by hMSBuild project. https://github.com/3F/hMSBuild --- .vssbe | 20 ++++++++++++---- README.md | 24 +++++++------------ build.bat | 9 ++++--- caller/gnt.bat | 4 ++-- compress.bat | 7 +++--- embedded/exec.tpl | 2 +- embedded/sha1.cmd | 7 +++--- msbuild.bat | 61 ----------------------------------------------- netmsb.bat | 44 ++++++++++++++++++++++++++++++++++ packing.bat | 7 +++--- 10 files changed, 85 insertions(+), 100 deletions(-) delete mode 100644 msbuild.bat create mode 100644 netmsb.bat diff --git a/.vssbe b/.vssbe index 9074d6e..413498b 100644 --- a/.vssbe +++ b/.vssbe @@ -71,13 +71,25 @@ " }, ", " \"$(odir)versions/02. wrapper/\", true)]", "", - "#[IO copy.file({ \"README.md\", \"changelog.txt\" }, \"$(odir)doc/\", true)]", - " ", - "#[IO copy.file({", + "#[IO copy.file(\"README.md\", \"$(odir)doc/Readme.md\", true)]", + "", + "#[IO write(\"$(odir)msbuild.bat\"):@echo off", + "echo.", + "echo The MSBuild-helper from GetNuTool is obsolete and was replaced by hMSBuild project.", + "echo Please look here: https://github.com/3F/hMSBuild", + "echo.", + "pause", + "]", + "", + "#[IO copy.file(\"changelog.txt\", \"$(odir)doc/\", true)]", + "", + "##[IO copy.file({", " \"msbuild.bat\",", " \"LICENSE\"", " },", - " \"$(odir)\", true)]" + " \"$(odir)\", true)]", + "", + "#[IO copy.file(\"LICENSE\", \"$(odir)License.txt\", true)]" ] } }, diff --git a/README.md b/README.md index fe09a27..dd177e3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # [GetNuTool](https://github.com/3F/GetNuTool) -The lightweight non-binary NuGet Client as a portable & embeddable tool for work with NuGet packages via basic MSBuild +The lightweight NuGet Client as a portable & embeddable tool for work with NuGet packages via basic MSBuild (it does not require any additional extensions). [![Build status](https://ci.appveyor.com/api/projects/status/rv65lbks5frc4k52/branch/master?svg=true)](https://ci.appveyor.com/project/3Fs/getnutool/branch/master) [![release-src](https://img.shields.io/github/release/3F/GetNuTool.svg)](https://github.com/3F/GetNuTool/releases/latest) [![License](https://img.shields.io/badge/License-MIT-74A5C2.svg)](https://github.com/3F/GetNuTool/blob/master/LICENSE) @@ -19,9 +19,13 @@ gnt /p:ngpackages="LunaRoad/1.4.1" # To get `LunaRoad` package v1.4 msbuild gnt.core /p:ngconfig="packages.config" # Use `packages.config` ``` -**Download:** [/releases](https://github.com/3F/GetNuTool/releases) ( [latest](https://github.com/3F/GetNuTool/releases/latest) ) - *Full version, Minified version, Compiled variant, Executable version* +**Download:** [/releases](https://github.com/3F/GetNuTool/releases) [ **[latest](https://github.com/3F/GetNuTool/releases/latest)** ] - *Full version, Minified version, Compiled variant, Executable version* -* Demo project: [GetNuTool v1.5 `get` & `pack` commands in use](https://ci.appveyor.com/project/3Fs/vssolutionbuildevent/build/build-178) +* Demo: [GetNuTool v1.5 `get` & `pack` commands in use](https://ci.appveyor.com/project/3Fs/vssolutionbuildevent/build/build-178) + +## Projects that based on GetNuTool core + +* [hMSBuild](https://github.com/3F/hMSBuild) - A lightweight tool (compiled batch file ~19 Kb that can be embedded inside any scripts or other batch files) - an easy helper for searching of available MSBuild tools. https://github.com/3F/hMSBuild ## License @@ -188,19 +192,9 @@ debug | false (by default), true | `v1.3+` To display additional information > msbuild gnt.core /t:pack /p:ngin="D:\tmp\7z.Libs" /p:ngout="newdir/" ``` -#### Paths to MSBuild Tools - -*Use our [msbuild-helper](https://github.com/3F/GetNuTool/blob/master/msbuild.bat) and have fun. But just a note where to find the MSBuild tools by default:* +#### Path to MSBuild Tools -* All available versions on your machine: `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions` - -```bash -"C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe" -"C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe" -C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe -C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe -+GAC_32, GAC_64, ... -``` +*If you need, try [hMSBuild](https://github.com/3F/hMSBuild) and have fun.* ## Compact & Minified versions diff --git a/build.bat b/build.bat index 24e021f..3edb47c 100644 --- a/build.bat +++ b/build.bat @@ -1,15 +1,14 @@ @echo off -set msbuild=msbuild.bat +set msbuild=netmsb call %msbuild% logic.targets /p:ngconfig="packages.config" /nologo /v:m /m:4 || goto err -call %msbuild% -notamd64 "gnt.sln" /l:"packages\vsSBE.CI.MSBuild\bin\CI.MSBuild.dll" /v:m /m:4 +call %msbuild% "gnt.sln" /l:"packages\vsSBE.CI.MSBuild\bin\CI.MSBuild.dll" /v:m /m:4 -goto exit +exit /B 0 :err echo. Build failed. 1>&2 - -:exit \ No newline at end of file +exit /B 1 \ No newline at end of file diff --git a/caller/gnt.bat b/caller/gnt.bat index 23cf146..99dedba 100644 --- a/caller/gnt.bat +++ b/caller/gnt.bat @@ -2,7 +2,7 @@ set gntcore=gnt.core -for %%v in (14.0, 12.0, 4.0, 3.5, 2.0) do ( +for %%v in (4.0, 14.0, 12.0, 3.5, 2.0) do ( for /F "usebackq tokens=2* skip=2" %%a in ( `reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\%%v" /v MSBuildToolsPath 2^> nul` ) do if exist %%b ( @@ -16,7 +16,7 @@ exit /B 2 :found -echo MSBuild Tools: %msbuildexe% +:: echo MSBuild Tools: %msbuildexe% %msbuildexe% %gntcore% /nologo /v:m /m:4 %* REM /noconlog diff --git a/compress.bat b/compress.bat index 394881c..28dbf6a 100644 --- a/compress.bat +++ b/compress.bat @@ -1,13 +1,12 @@ @echo off -set msbuild=msbuild.bat +set msbuild=netmsb call %msbuild% minified/.compressor /p:core="../logic.targets" /p:output="gnt.core" /nologo /v:m /m:4 %* || goto err -goto exit +exit /B 0 :err echo. Build failed. 1>&2 - -:exit \ No newline at end of file +exit /B 1 \ No newline at end of file diff --git a/embedded/exec.tpl b/embedded/exec.tpl index 90c6b3e..237fc80 100644 --- a/embedded/exec.tpl +++ b/embedded/exec.tpl @@ -13,7 +13,7 @@ set a=%a:"=% if "%a:~0,8%"=="-unpack " goto unpack if "%a:~0,9%"=="-msbuild " goto ufound -for %%v in (14.0, 12.0, 4.0, 3.5, 2.0) do ( +for %%v in (4.0, 14.0, 12.0, 3.5, 2.0) do ( for /F "usebackq tokens=2* skip=2" %%a in ( `reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\%%v" /v MSBuildToolsPath 2^> nul` ) do if exist %%b ( diff --git a/embedded/sha1.cmd b/embedded/sha1.cmd index 9275f6f..3d0edc2 100644 --- a/embedded/sha1.cmd +++ b/embedded/sha1.cmd @@ -1,16 +1,15 @@ @echo off -set msbuild="%~dp0\..\msbuild.bat" +set msbuild="%~dp0\..\netmsb.bat" echo SHA-1 test has been started. call "%~dp0\gnt" -unpack || goto err call %msbuild% "%~dp0\sha1_comparer.targets" /p:core1="%~dp0\../minified/gnt.core" /p:core2="%~dp0\gnt.core" /nologo /v:m /m:4 || goto err -goto exit +exit /B 0 :err echo. Build failed. 1>&2 - -:exit \ No newline at end of file +exit /B 1 \ No newline at end of file diff --git a/msbuild.bat b/msbuild.bat deleted file mode 100644 index 57b2328..0000000 --- a/msbuild.bat +++ /dev/null @@ -1,61 +0,0 @@ -@echo off -setlocal enableDelayedExpansion - -:: The MSBuild-helper. Part of GetNuTool -:: https://github.com/3F/GetNuTool - -:: arguments: -:: -:: msbuild -notamd64 - to select x86 instance instead of x64 if it's possible. -:: msbuild - to select any available instance. -:: - -set args=%* -set notamd64=0 - -set a=%args:~0,30% -set a=%a:"=% - -if "%a:~0,10%"=="-notamd64 " ( - call :popa %1 - shift - set notamd64=1 -) - -for %%v in (14.0, 12.0, 4.0, 3.5, 2.0) do ( - for /F "usebackq tokens=2* skip=2" %%a in ( - `reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\%%v" /v MSBuildToolsPath 2^> nul` - ) do if exist %%b ( - - if NOT "%notamd64%" == "1" ( - set msbuildexe=%%b\MSBuild.exe - goto found - ) - - :: 7z & amd64\msbuild - https://github.com/3F/vsSolutionBuildEvent/issues/38 - set _amd=..\MSBuild.exe - if exist "%%b/!_amd!" ( - set msbuildexe=%%b\!_amd! - ) else ( - set msbuildexe=%%b\MSBuild.exe - ) - goto found - ) -) - -echo MSBuild was not found, try: ` "full_path_to_msbuild.exe" arguments ` 1>&2 -exit /B 2 - - -:found - -set msbuildexe="%msbuildexe%" -echo MSBuild Tools: %msbuildexe% - -%msbuildexe% %args% - -exit /B 0 - -:popa -call set args=%%args:%1 ^=%% -exit /B 0 diff --git a/netmsb.bat b/netmsb.bat new file mode 100644 index 0000000..e3855a0 --- /dev/null +++ b/netmsb.bat @@ -0,0 +1,44 @@ +@echo off +setlocal enableDelayedExpansion + +:: Part of GetNuTool - https://github.com/3F/GetNuTool +:: :: If you need a common MSBuild-helper, look here - https://github.com/3F/hMSBuild + + +:: cfg + +:: 7z & amd64\msbuild - https://github.com/3F/vsSolutionBuildEvent/issues/38 +set notamd64=1 + + +:: - + +for %%v in (4.0, 3.5, 2.0) do ( + for /F "usebackq tokens=2* skip=2" %%a in ( + `reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\%%v" /v MSBuildToolsPath 2^> nul` + ) do if exist %%b ( + + set msbuildexe=%%b\MSBuild.exe + + if NOT "%notamd64%" == "1" ( + goto found + ) + + set _amd=!msbuildexe:Framework64=Framework! + set _amd=!_amd:amd64=! + + if exist "!_amd!" ( + set msbuildexe=!_amd! + ) + goto found + + ) +) +echo MSBuild was not found. 1>&2 +exit /B 2 + +:found + +"!msbuildexe!" %* + +exit /B 0 diff --git a/packing.bat b/packing.bat index 3b2c718..02e330a 100644 --- a/packing.bat +++ b/packing.bat @@ -1,16 +1,15 @@ @echo off -set msbuild=msbuild.bat +set msbuild=netmsb call compress || goto err call %msbuild% embedded/.packer /p:core="../minified/gnt.core" /p:output="gnt.bat" /nologo /v:m /m:4 %* || goto err embedded/sha1 -goto exit +exit /B 0 :err echo. Build failed. 1>&2 - -:exit \ No newline at end of file +exit /B 1 \ No newline at end of file