Example #1
0
        public static void Main(string[] args)
        {
            var projFile = args.FirstOrDefault();

            if (string.IsNullOrEmpty(projFile))
            {
                //TODO: show command line options
                Console.WriteLine("Using: prj2json <csprojectname.csproj>");
                return;
            }
            var project = SharpProject.FromFile(projFile);
            IEnumerable <PropertyGroup> debugGroups   = project.DebugPropertyGroupCollection;
            IEnumerable <PropertyGroup> releaseGroups = project.ReleasePropertyGroupCollection;

            foreach (var group in debugGroups)
            {
                var buildCommand = BashHelper.CreateBuildCommand(group.ProjectName, group.Configuration);
                var runCommand   = BashHelper.CreateRunCommand(group.Path);
                Debug.WriteLine(buildCommand);
                Debug.WriteLine(runCommand);
            }

            var    serializer       = new JavaScriptSerializer();
            var    serializedResult = serializer.Serialize(new LaunchTask());
            string json             = JsonConvert.SerializeObject(new LaunchTask());
        }
Example #2
0
        public static SharpProject FromFile(string filename)
        {
            var result = new SharpProject
            {
                Name = filename
            };

            var serializer = new XmlSerializer(typeof(Project));

            using (var stream = new StreamReader(filename))
            {
                result._project = (Project)serializer.Deserialize(stream);
            }

            foreach (var propertyGroup in result._project.PropertyGroup)
            {
                propertyGroup.Parent = result;
            }

            return(result);
        }