示例#1
0
        public bool BuildTargetGaugeProject()
        {
            var projectFullPath = GetProjectFullPath();
            var projectConfig   = GetProjectConfiguration();
            var projectPlatform = GetProjectPlatform();
            var gaugeBinDir     = Utils.GetGaugeBinDir();

            try
            {
                var properties = new FSharpList <Tuple <string, string> >(Tuple.Create("Configuration", projectConfig),
                                                                          FSharpList <Tuple <string, string> > .Empty);
                properties = new FSharpList <Tuple <string, string> >(Tuple.Create("Platform", projectPlatform), properties);
                properties = new FSharpList <Tuple <string, string> >(Tuple.Create("OutputPath", gaugeBinDir), properties);
                MSBuildHelper.build(FuncConvert.ToFSharpFunc(delegate(MSBuildHelper.MSBuildParams input)
                {
                    input.Verbosity =
                        FSharpOption <MSBuildHelper.MSBuildVerbosity> .Some(MSBuildHelper.MSBuildVerbosity.Quiet);
                    input.Targets    = new FSharpList <string>("Build", FSharpList <string> .Empty);
                    input.Properties = properties;
                    return(input);
                }), projectFullPath);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "C# Project build failed {0}", ex.Message);
                return(false);
            }
            return(true);
        }
示例#2
0
        private static string GetProjectPlatform()
        {
            var csprojEnvVariable = Utils.TryReadEnvValue("GAUGE_CSHARP_PROJECT_PLATFORM");

            if (!string.IsNullOrEmpty(csprojEnvVariable))
            {
                return(csprojEnvVariable);
            }

            return("Any CPU");
        }
示例#3
0
        private static string GetProjectConfiguration()
        {
            var csprojEnvVariable = Utils.TryReadEnvValue("GAUGE_CSHARP_PROJECT_CONFIG");

            if (!string.IsNullOrEmpty(csprojEnvVariable))
            {
                return(csprojEnvVariable);
            }

            return("Debug");
        }
示例#4
0
        private static string GetProjectFullPath()
        {
            var csprojEnvVariable = Utils.TryReadEnvValue("GAUGE_CSHARP_PROJECT_FILE");

            if (!string.IsNullOrEmpty(csprojEnvVariable))
            {
                return(csprojEnvVariable);
            }

            var projectFileList = Directory.GetFiles(Utils.GaugeProjectRoot, "*.csproj");

            if (!projectFileList.Any())
            {
                throw new NotAValidGaugeProjectException();
            }
            var projectFullPath = projectFileList.First();

            return(projectFullPath);
        }