cake-build / resources

Contains different kind of resources such as bootstrappers and configuration files.
MIT License
54 stars 79 forks source link

[build.csproj] add MSBuild script that allow made bootstrap at develop environment. #67

Closed TheVice closed 3 years ago

TheVice commented 5 years ago

Hello.

Bash and PowerShell scripts used as source for MSBuild script and provided functionality at base system environment.

Comparing to current versions of it at MSBuild approach by default use nuget source for NuGet.exe and create packages.config if it required, that allow use it at isolated environment with nuget proxy enabled. If need script behavior addition property was added - ForceDownloaPackagesConfig and ForceDownloadNuGetFile that will allow use download from the web.

"<MSBuild\15.0\Bin\MSBuild.exe>" "" /p:ForceDownloaPackagesConfig=Y /p:ForceDownloadNuGetFile=Y dotnet msbuild "" /p:ForceDownloaPackagesConfig=Y /p:ForceDownloadNuGetFile=Y

Download from NuGet provided by creating C# project, for .NET Framework or .NET Core, that have dependence on NuGet.CommandLine. Output of project calculate hash sum of packages.config.

Also Bash and PowerShell download file where by default used Cake for .NET Framework/Mono environment. At MSBuild script provided checking and choose will be provided between .NET Framework and .NET Core, in other words between Cake and Cake.CoreCLR NuGet packages. To return original implementation CakeId property should be used.

"<MSBuild\15.0\Bin\MSBuild.exe>" "" /p:CakeId=Cake dotnet msbuild "" /p:CakeId=Cake

In a future Mono less can be provided if increase project not only calculate hash sum but also download Cake of required type – in other word replace NuGet.CommandLine with C# functional at project. Run of NuGet.exe is dependence in this project on Mono. Also possibility to run Cake.exe at Linux rather that 'dotnet Cake.dll' too required Mono. Addition variant can be more prefer for one of previous version of Cake and left space for regression changes in a future.

MSBuild script allow to set path to the NuGet.Config ( %APPDATA%\NuGet\NuGet.Config or $HOME/.nuget/NuGet/NuGet.Config depend of your system) for NuGet.exe tool and Cake process. While run at proxy environment sometimes default location ignored, so such set can deal with it

"<MSBuild\15.0\Bin\MSBuild.exe>" "" /p:"NuGetCommandArguments=-ConfigFile %APPDATA%\NuGet\NuGet.Config" /p:"NuGet_ConfigFile=%APPDATA%\NuGet\NuGet.Config" dotnet msbuild "" /p:"NuGetCommandArguments=-ConfigFile $HOME/.nuget/NuGet/NuGet.Config" /p:"NuGet_ConfigFile=$HOME/.nuget/NuGet/NuGet.Config"

For set script argument next form can be used:

"<MSBuild\15.0\Bin\MSBuild.exe>" "" /p:"CAKE_ARGUMENTS=-verbosity=Quiet --script_argument=value" /verbosity:quiet dotnet msbuild "<MSBuild\15.0\Bin\MSBuild.exe>" "" /p:"CAKE_ARGUMENTS=-verbosity=Quiet --script_argument=value" /verbosity:quiet

In sample above second verbosity is for MSBuild process, can not access to such one, so for Cake process it duplicate at CAKE_ARGUMENTS MSBuild property.

Thank you.

dnfclas commented 5 years ago

CLA assistant check
All CLA requirements met.

pascalberger commented 3 years ago

@TheVice Thank you for the pull request.

We did some maintenance work on this repo which included removing of the develop branch which closed this PR.

Since this PR was created we introduced and made Cake .NET Tool the recommended runner, which has a much simpler bootstrapping story.