Closed ErikSchierboom closed 7 years ago
A few thoughts --
While I appreciate the effort, I'm not sure there's much benefit to getting this to build on Mono. The official builds & packages are created as part of the CI build on AppVeyor here: https://ci.appveyor.com/project/onovotny/referencegenerator
What would be helpful is updating the included targets file (https://github.com/onovotny/ReferenceGenerator/blob/master/src/ReferenceGenerator/NuSpec.ReferenceGenerator.targets) so that the tool runs when other solutions are using it on mono.
There's also another issue - right now the tool needs the Reference Assemblies for the PCL references in order to read their assembly versions. These files are all present on a Windows dev system. I have no idea if/where they'd be on a system with Mono on it. What we need are the equivalent of the assemblies under C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\{version}\Profile\{ProfileNumber}\*
.
Without those Reference assemblies, the tool cannot get the data it needs for a "classic PCL". It can still work for a "modern PCL," that is one that uses the .NET Core references with a project.json file. Note that you can also have a project.json PCL that uses "classic" references too. Here's an example of that: https://github.com/Humanizr/Humanizer/blob/dev/src/Humanizer/project.json#L6.
Okay, so would you rather I'd ditch the whole Mono building? I could also support a Mono build but skip the actual creation of the RefGen.exe tool, thereby losing the need for an Mono version of the buildpackagelayout.cmd
file.
As for the NuSpec.ReferenceGenerator.Targets
file, I'll look into that.
You're welcome to get it building on mono if you'd like but I'm just not sure what benefit that adds overall. I'd rather not have to keep too many differences just to build on mono. I think there's much more value in ensuring the tool runs well on mono.
Okay, when I try to use Mono to run the executable I get: File does not contain a valid CIL image.
My best bet is that that is due to the ILMerge command.
How would I go about creating a minimal test project to see if I can get it working?
This PR is the first attempt at getting the project to build on Mono. To get it building, I have done the following:
ReferenceGenerator.Mono.sln
that is the same as the regular solution, but does not include the UWP project, which Mono cannot build as far as I knowbuild.sh
file that can build the solution on Mono. I used xUnit's build.sh file as the starting point.buildpackagelayout.sh
file that uses ILRepack as ILMerge is not available on MonoReferenceGenerator.csproj
file to conditionally execute either thebuildpackagelayout.cmd
file on Windows orbuildpackagelayout.sh
on Mono. This is the most important step in getting it to also build on Mono.nuget
directory to the.gitignore
fileThe
build.sh
succesfully compiles the project on my machine now, but there is still one import step that is not working: thebuildpackagelayout.sh
throws an exception:I don't really know ILRepack, but to me it appears that it tries to resolve a dependency of Newtonsoft.Json.dll
named
System.Runtime.Serialization.Formatters.FormatterAssemblyStyle`, which it can't find. I did some Googling and found the following SO link. This appears to be related, but I'm not sure how I can fix this. Any ideas?