Exemple #1
0
        /// <summary>
        /// Gets the Visual Studio version to be used.
        /// <para>
        /// If the user has specified the version than that version will be used.
        /// </para>
        /// If the user has specified Auto then we will determine VS's appropriate
        /// version based on the version of the file (.sln) we are going to build
        /// </summary>
        /// <param name="fileName">The name of the solution file to get the version (full path). Only used if <value>TfsBuildExtensions.Activities.VisualStudio.VSVersion.Auto</value> is specified</param>
        /// <param name="version">The version</param>
        /// <returns>The devenv version that will be used</returns>
        private static VSVersionInternal GetVersion(string fileName, VSVersion version)
        {
            if (version != VSVersion.Auto)
            {
                return((VSVersionInternal)(int)version);
            }

            var solution = new VSSolution(fileName);

            return(solution.FriendlyVersion);
        }
Exemple #2
0
            /// <summary>
            /// Validates the main activity parameters
            /// </summary>
            protected override void InternalExecute()
            {
                var filePath = this.FilePath.Get(this.ActivityContext);
                var version  = this.Version.Get(this.ActivityContext);

                if (string.IsNullOrWhiteSpace(filePath) || File.Exists(filePath) == false)
                {
                    this.LogBuildError(string.Format("File {0} not found.", filePath));

                    this.HasErrors.Set(this.ActivityContext, true);

                    return;
                }

                if (version == VSVersion.Auto && VSSolution.CanAutoDetectVersion(filePath) == false)
                {
                    this.LogBuildError("Can only auto detect DevEnv version for solution files. For project files you need to explicitily set the version");

                    this.HasErrors.Set(this.ActivityContext, true);
                }
            }
        /// <summary>
        /// Gets the Visual Studio version to be used.
        /// <para>
        /// If the user has specified the version than that version will be used.
        /// </para>
        /// If the user has specified Auto then we will determine VS's appropriate
        /// version based on the version of the file (.sln) we are going to build
        /// </summary>
        /// <param name="fileName">The name of the solution file to get the version (full path). Only used if <value>TfsBuildExtensions.Activities.VisualStudio.VSVersion.Auto</value> is specified</param>
        /// <param name="version">The version</param>
        /// <returns>The devenv version that will be used</returns>
        private static VSVersionInternal GetVersion(string fileName, VSVersion version)
        {
            if (version != VSVersion.Auto)
            {
                return (VSVersionInternal)(int)version;
            }

            var solution = new VSSolution(fileName);
            return solution.FriendlyVersion;
        }