@@ -538,11 +538,19 @@ tidy:
538538$(BUILD_DIR )$(PROJECT_DIR ) % .zip : $(PROJECT_DIR ) % .zip
539539 @mkdir -p $(dir $@ )
540540 @rsync -av $(subst $(BUILD_DIR ) ,,$@ ) $@
541+
542+ $(PROJECT_DIR ) % .zip : $(PROJECT_DIR ) % /* /Program.cs | $(PROJECT_DIR ) /% /* /* .cs
543+ @ (printf ' <Project Sdk="Microsoft.NET.Sdk">\n <PropertyGroup>\n <OutputType>Exe</OutputType>\n <TargetFramework>net10.0</TargetFramework>\n <ImplicitUsings>enable</ImplicitUsings>\n <Nullable>enable</Nullable>\n </PropertyGroup>\n \n</Project>' ) > $(dir $< )$(notdir $(patsubst % /,% ,$(dir $< ) ) ) .csproj
544+ # We now zip the folder:
545+ @cd $(dir $(patsubst %/,%,$(dir $<))) && 7z a $(notdir $@) $(notdir $*) -xr\!.vs -xr\!.directory > nul && mv $(notdir $@) ../
546+ # We compress (silently, thanks to the -bso0 -bsp0 options) the folder containing the csproj and the code
547+ # Finally, we clean the files:
548+ @rm $(dir $<)$(notdir $(patsubst %/,%,$(dir $<))).csproj
541549
542550# Rule to create one individual project and zip it:
543551# The code below is taken from and documented at
544552# https://github.com/princomp/C-Sharp-project-maker
545- $(PROJECT_DIR ) % .zip : $(PROJECT_DIR ) % /* /Program.cs | $(PROJECT_DIR ) /% /* /* .cs
553+ $(PROJECT_DIR ) % _v4.5.2 .zip : $(PROJECT_DIR ) % /* /Program.cs | $(PROJECT_DIR ) /% /* /* .cs
546554#
547555# The structure of an archive is as follows:
548556# └───<Solution> $(notdir $*)
@@ -601,6 +609,11 @@ $(PROJECT_DIR)%.zip: $(PROJECT_DIR)%/*/Program.cs | $(PROJECT_DIR)/%/*/*.cs
601609 @cd $(dir $(patsubst %/,%,$(dir $<)))../ && 7z a $(notdir $@) $(notdir $*) -xr\!.vs -xr\!.directory > nul
602610# We compress the folder containing the sln and the folder containing the csproj and the code
603611# But we exclude the .vs folder and .directory file
612+ # Finally, we clean the files:
613+ @rm -rf $(dir $(patsubst %/,%,$(dir $<)))/$(notdir $*).sln
614+ @rm -rf $(dir $<)$(notdir $(patsubst %/,%,$(dir $<))).csproj
615+ @rm -rf $(dir $<)Properties
616+ @rm -rf $(dir $<)Properties/AssemblyInfo.cs
604617
605618# -------------------------------
606619# Book files
0 commit comments