icsharpcode / ILSpy

.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
21.45k stars 3.35k forks source link

UpdateAssemblyInfo.exe not generated with shadow builds #638

Closed jleclanche closed 7 years ago

jleclanche commented 9 years ago

When trying to build the project on Linux, I get this:

Project "/home/adys/src/git/extract-scripts/decompiler/ILSpy/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj" (default target(s)):
        Target BeforeBuild:
                Project "/home/adys/src/git/extract-scripts/decompiler/ILSpy/BuildTools/UpdateAssemblyInfo/UpdateAssemblyInfo.csproj" (Build target(s)):
                        Target PrepareForBuild:
                                Configuration: Debug Platform: AnyCPU
                        Target GenerateSatelliteAssemblies:
                        No input files were specified for target GenerateSatelliteAssemblies, skipping.
                        Target GenerateTargetFrameworkMonikerAttribute:
                        Skipping target "GenerateTargetFrameworkMonikerAttribute" because its outputs are up-to-date.
                        Target CoreCompile:
                        Skipping target "CoreCompile" because its outputs are up-to-date.
                Done building project "/home/adys/src/git/extract-scripts/decompiler/ILSpy/BuildTools/UpdateAssemblyInfo/UpdateAssemblyInfo.csproj".
                Executing: UpdateAssemblyInfo.exe
                /tmp/tmp32e02900.tmp: line 1: UpdateAssemblyInfo.exe: command not found
/home/adys/src/git/extract-scripts/decompiler/ILSpy/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj: error : Command 'UpdateAssemblyInfo.exe' exited with code: 127.
        Task "Exec" execution -- FAILED
        Done building target "BeforeBuild" in project "/home/adys/src/git/extract-scripts/decompiler/ILSpy/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj".-- FAILED
Done building project "/home/adys/src/git/extract-scripts/decompiler/ILSpy/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj".-- FAILED
jleclanche commented 8 years ago

Ping. Any idea?

linquize commented 8 years ago

What is your mono version?

jleclanche commented 8 years ago

4.0.4.1

jleclanche commented 7 years ago

So I mean, this is still the case. I work around it with this:

diff --git a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
index 99b6693f..6eee5e26 100644
--- a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
+++ b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
@@ -154,9 +154,4 @@
   </ItemGroup>
   <ItemGroup />
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
-  <Target Name="BeforeBuild">
-    <MSBuild Projects="$(MSBuildProjectDirectory)\..\BuildTools\UpdateAssemblyInfo\UpdateAssemblyInfo.csproj" Targets="Build" Properties="Configuration=Debug; Platform=AnyCPU" />
-    <Exec WorkingDirectory="$(MSBuildProjectDirectory)\..\BuildTools\UpdateAssemblyInfo\bin\Debug" Command="UpdateAssemblyInfo.exe --branchname $(BranchName)" Timeout="60000" Condition=" '$(BranchName)' != '' " />
-    <Exec WorkingDirectory="$(MSBuildProjectDirectory)\..\BuildTools\UpdateAssemblyInfo\bin\Debug" Command="UpdateAssemblyInfo.exe" Timeout="60000" Condition=" '$(BranchName)' == '' " />
-  </Target>
-</Project>
\ No newline at end of file
+</Project>

But then it can't find the AssemblyInfo.cs file it generates (obviously), so I have to remove these two includes:

-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <None Include="Properties\AssemblyInfo.template.cs" />

This is all with xbuild. msbuild gives a different, perhaps more helpful error:

Microsoft (R) Build Engine version 15.2.0.0 ( Thu May 11 17:28:41 UTC 2017)
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 6/30/2017 12:40:30 AM.
Project "/home/admin/tmp/ILSpy/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj" on node 1 (default targets).
Project "/home/admin/tmp/ILSpy/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj" (1) is building "/home/admin/tmp/ILSpy/BuildTools/UpdateAssemblyInfo/UpdateAssemblyInfo.csproj" (2) on node 1 (Build target(s)).                  
PrepareForBuild:                                                                                                                                                                                                                       
  Creating directory "./build/".                                                                                                                                                                                                       
ResolveAssemblyReferences:                                                                                                                                                                                                             
  A TargetFramework profile exclusion list will be generated.                                                                                                                                                                          
/usr/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): warning MSB3256: No assemblies were read in from the redist lists. A TargetFramework profile exclusion list could not be generated.  [/home/admin/tmp/ILSpy/BuildTools/UpdateAssemblyInfo/UpdateAssemblyInfo.csproj]                                                                                                                                                                          
GenerateTargetFrameworkMonikerAttribute:                                                                                                                                                                                               
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.                                                                                                     
CoreCompile:                                                                                                                                                                                                                           
  /usr/lib/mono/4.5/csc.exe /noconfig /unsafe- /checked- /nowarn:1607,1701,1702 /nostdlib+ /platform:x86 /warn:4 /baseaddress:4194304 /define:DEBUG;TRACE /highentropyva- /reference:/usr/lib/mono/4.0-api/mscorlib.dll /reference:/usr/lib/mono/4.0-api/System.Core.dll /reference:/usr/lib/mono/4.0-api/System.Data.DataSetExtensions.dll /reference:/usr/lib/mono/4.0-api/System.Data.dll /reference:/usr/lib/mono/4.0-api/System.dll /reference:/usr/lib/mono/4.0-api/System.Xml.dll /reference:/usr/lib/mono/4.0-api/System.Xml.Linq.dll /debug+ /debug:portable /filealign:4096 /optimize- /out:obj/Debug/UpdateAssemblyInfo.exe /target:exe /warnaserror- /utf8output Main.cs "/tmp/.NETFramework,Version=v4.0,Profile=Client.AssemblyAttributes.cs"
CopyFilesToOutputDirectory:
  Copying file from "obj/Debug/UpdateAssemblyInfo.exe" to "./build/UpdateAssemblyInfo.exe".                                                                                                                                            
  UpdateAssemblyInfo -> /home/admin/tmp/ILSpy/BuildTools/UpdateAssemblyInfo/build/UpdateAssemblyInfo.exe                                                                                                                               
  Copying file from "obj/Debug/UpdateAssemblyInfo.pdb" to "./build/UpdateAssemblyInfo.pdb".
Done Building Project "/home/admin/tmp/ILSpy/BuildTools/UpdateAssemblyInfo/UpdateAssemblyInfo.csproj" (Build target(s)).                                                                                                               
BeforeBuild:                                                                                                                                                                                                                           
  mono UpdateAssemblyInfo.exe                                                                                                                                                                                                          
/home/admin/tmp/ILSpy/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj(160,5): error MSB6003: The specified task executable "sh" could not be run. The working directory "/home/admin/tmp/ILSpy/ICSharpCode.Decompiler/../BuildTools/UpdateAssemblyInfo/bin/Debug" does not exist.                                                                                                                                                                                        
Done Building Project "/home/admin/tmp/ILSpy/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj" (default targets) -- FAILED.                                                                                                        

Build FAILED.

"/home/admin/tmp/ILSpy/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj" (default target) (1) ->                                                                                                                                   
"/home/admin/tmp/ILSpy/BuildTools/UpdateAssemblyInfo/UpdateAssemblyInfo.csproj" (Build target) (2) ->                                                                                                                                  
(ResolveAssemblyReferences target) ->                                                                                                                                                                                                  
  /usr/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): warning MSB3256: No assemblies were read in from the redist lists. A TargetFramework profile exclusion list could not be generated.  [/home/admin/tmp/ILSpy/BuildTools/UpdateAssemblyInfo/UpdateAssemblyInfo.csproj]                                                                                                                                                                        

"/home/admin/tmp/ILSpy/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj" (default target) (1) ->                                                                                                                                   
(BeforeBuild target) ->                                                                                                                                                                                                                
  /home/admin/tmp/ILSpy/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj(160,5): error MSB6003: The specified task executable "sh" could not be run. The working directory "/home/admin/tmp/ILSpy/ICSharpCode.Decompiler/../BuildTools/UpdateAssemblyInfo/bin/Debug" does not exist.                                                                                                                                                                                      

    1 Warning(s)                                                                                                                                                                                                                       
    1 Error(s)                                                                                                                                                                                                                         

Time Elapsed 00:00:02.74
jleclanche commented 7 years ago

Worth noting, msbuild does not work out of the box:

/home/admin/tmp/ILSpy/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj(154,3): error MSB4019: The imported project "/usr/lib/mono/msbuild/15.0/bin/Microsoft.CSharp.Targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

The problem is that /usr/lib/mono/msbuild/15.0/bin/Microsoft.CSharp.Targets does not exist, but /usr/lib/mono/msbuild/15.0/bin/Microsoft.CSharp.targets does exist (debian jessie, mono-devel); in fact, all of the files in that directory are .targets, no .Targets.

jleclanche commented 7 years ago

Okay, I see what's going on, I should have looked closer when I first wrote the issue. The problem is I am passing /property:OutputPath=../build, and this is not supported due to the way the decompiler is calling UpdateAssemblyInfo.exe.

jleclanche commented 7 years ago

Updated issue name to reflect the root cause. The build succeeds if I don't shadow-build.

siegfriedpammer commented 7 years ago

After the newdecompiler landed back on master we've added ICSharpCode.Decompiler.Console.sln, it should be fullly compatible with Unix. Please give it a try!

Edit: Note: PowerShell is required to get the build process working on Unix. Get it from here: https://github.com/PowerShell/PowerShell/releases