public static string TryGetTeamCityMsbuildLoggerParam(TargetDotNetFrameworkVersion version, TeamCityProperties tc = null)
    {
      tc = tc ?? new TeamCityProperties();

      if(!tc.IsRunningInTeamCity)
        return null;

      // Differs by MSBuild version
      if(version < TargetDotNetFrameworkVersion.Version20)
        return null;
      string prop = version >= TargetDotNetFrameworkVersion.Version40 ? "teamcity.dotnet.msbuild.extensions4.0" : "teamcity.dotnet.msbuild.extensions2.0";

      // Read path from TC config
      var pathDll = new FileSystemPath(tc.GetConfigurationProperty(prop));
      if(!pathDll.ExistsFile)
        throw new InvalidOperationException("There's the TeamCity MSBuild logger path, but it does not exist on disk.");

      // Make the path
      string sClassName = "JetBrains.BuildServer.MSBuildLoggers.MSBuildLogger";

      return sClassName + "," + pathDll.FullPath + ";";
    }
Exemplo n.º 2
0
        public static string TryGetTeamCityMsbuildLoggerParam(TargetDotNetFrameworkVersion version, TeamCityProperties tc = null)
        {
            tc = tc ?? new TeamCityProperties();

            if (!tc.IsRunningInTeamCity)
            {
                return(null);
            }

            // Differs by MSBuild version
            if (version < TargetDotNetFrameworkVersion.Version20)
            {
                return(null);
            }
            string prop = version >= TargetDotNetFrameworkVersion.Version40 ? "teamcity.dotnet.msbuild.extensions4.0" : "teamcity.dotnet.msbuild.extensions2.0";

            // Read path from TC config
            var pathDll = new FileSystemPath(tc.GetConfigurationProperty(prop));

            if (!pathDll.ExistsFile)
            {
                throw new InvalidOperationException("There's the TeamCity MSBuild logger path, but it does not exist on disk.");
            }

            // Make the path
            string sClassName = "JetBrains.BuildServer.MSBuildLoggers.MSBuildLogger";

            return(sClassName + "," + pathDll.FullPath + ";");
        }