internal static ProjectCollection CreateProjectCollection()
        {
            string toolsPath         = VisualStudioSolutionUtility.GetMSBuildPath();
            var    globalProperties  = GetGlobalProperties(VisualStudioSolutionUtility.GetMSBuildPath());
            var    projectCollection = new ProjectCollection(globalProperties);

            // change toolset to internal.
            projectCollection.AddToolset(new Toolset(ToolLocationHelper.CurrentToolsVersion, toolsPath, projectCollection, string.Empty));
            return(projectCollection);
        }
示例#2
0
        /// <summary>
        /// Compile assembly
        /// </summary>
        /// <param name="rebuild"></param>
        /// <param name="outputAssemblyNameOverride"></param>
        /// <returns></returns>
        public static bool Compile(bool rebuild, string outputAssemblyNameOverride = null, string outputDirOverride = null)
        {
            var config = new VisualStudioSolutionUtility.BuildConfig();

            config.BuildConfiguration = "Release";
            //config.BuildConfiguration = ProjectSettings.Get.CSharpEditorBuildConfiguration;
            //config.BuildConfiguration = BuildConfiguration;

            config.OutDir             = outputDirOverride ?? OutputDir;
            config.OutputAssemblyName = outputAssemblyNameOverride ?? OutputAssemblyName;

            if (IOUtility.IsFileLocked(Path.Combine(config.OutDir, config.OutputAssemblyName + ".dll")))
            {
                Log.Error($"\'{config.OutputAssemblyName}.dll\' compilation skipped because output file is locked.");
                return(false);                // throw exception or warn message ?
            }

            return(VisualStudioSolutionUtility.BuildSolution(ProjectDir, Name, config, rebuild));
        }
示例#3
0
        internal static ProjectCollection CreateProjectCollection()
        {
            //!!!!
            //var ss = ToolLocationHelper.GetPathToBuildToolsFile( "msbuild.exe", ToolLocationHelper.CurrentToolsVersion );
            //Log.Info( ss );

            string toolsPath         = VisualStudioSolutionUtility.GetMSBuildFolderPath();
            var    globalProperties  = GetGlobalProperties(VisualStudioSolutionUtility.GetMSBuildFolderPath());
            var    projectCollection = new ProjectCollection(globalProperties);

            // change toolset to internal.

            //var toolsPath2 = ToolLocationHelper.GetPathToBuildTools( ToolLocationHelper.CurrentToolsVersion );
            //Log.Info( toolsPath2 );

            //!!!!
            ////projectCollection.AddToolset( new Toolset( "3.1.302", toolsPath, projectCollection, string.Empty ) );
            projectCollection.AddToolset(new Toolset(ToolLocationHelper.CurrentToolsVersion, toolsPath, projectCollection, string.Empty));
            return(projectCollection);
        }