public SolutionBase LoadSolution(SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver)
        {
            if (solutionTask.SolutionFile == null)
            {
                return(new GenericSolution(solutionTask, tfc, gacCache, refResolver));
            }
            else
            {
                // determine the solution file format version

                // will hold the content of the solution file
                string fileContents;

                using (StreamReader sr = new StreamReader(solutionTask.SolutionFile.FullName, Encoding.Default, true)) {
                    fileContents = sr.ReadToEnd();
                }

                ISolutionBuildProvider provider = FindProvider(fileContents);
                if (provider != null)
                {
                    return(provider.GetInstance(fileContents, solutionTask, tfc, gacCache, refResolver));
                }
                throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                                                       "Solution format of file '{0}' is not supported.", solutionTask.SolutionFile),
                                         Location.UnknownLocation);
            }
        }
 private ISolutionBuildProvider FindProvider(string fileContents) {
     int max = 0;
     ISolutionBuildProvider res = null;
     foreach (ISolutionBuildProvider provider in _projectProviders) {
         int pri = provider.IsSupported(fileContents);
         if (pri > max) {
             max = pri;
             res = provider;
         }
     }
     return res;
 }
 public void RegisterProvider(ISolutionBuildProvider provider)
 {
     _projectProviders.Add(provider);
 }
Beispiel #4
0
 public void RegisterProvider(ISolutionBuildProvider provider)
 {
     _projectProviders.Add(provider);
 }