emerbrito / ILMerge-MSBuild-Task

Adds ILMerge to Visual Studio 2013/2017 or automated builds. This Task is intended to work right out of the box however, it supports a configuration file where you can control every ILMerge property including the list of assemblies to be merged.
MIT License
54 stars 15 forks source link

NullReferenceExceptions when using a config file #7

Closed slahn closed 7 years ago

slahn commented 7 years ago

I've had to add the following to our config file in order to avoid Null reference exceptions when merging:

"Advanced": {
  "SearchDirectories" :  []
}
slahn commented 7 years ago

This is because constructors are not run when using DataContractSerializer.

You could implement initialization methods and use [OnDeserializing], or you could switch to Newtonsoft.Json.

I'm happy to supply a pull request for either of them. Which would you prefer?

emerbrito commented 7 years ago

I believe Newtonsoft.Json might be overkill for this. If you provide the pull request I will be more than happy to merge it. Otherwise I will work on it mid next week. Thanks for your help.

emerbrito commented 7 years ago

Replaced Newtonsoft.Json with JavaScriptSerializer (from System.Web.Script.Serialization) to prevent having to load the third party assembly during build.