コード例 #1
0
        private IEnumerable <string> GetCompilerArgs()
        {
            var args = new List <string>();

            foreach (var sourceFile in SourceFiles)
            {
                args.Add(string.Format("\"{0}\"", sourceFile));
            }

            foreach (var reference in References)
            {
                var assemblyName = new AssemblyName(reference);
                args.Add(string.Format("\"/ref:{0}.dll\"", assemblyName.Name));
            }

            TargetExtension = OutputType.ToLowerInvariant() == "library" ? ".dll" : ".exe";
            args.Add(string.Format("\"/out:{0}\"", Path.Combine(OutputPath, AssemblyName + TargetExtension)));
            args.Add("/" + OutputType);

            if (!EnableOptimizations)
            {
                args.Add("/debug");
            }

            return(args);
        }
コード例 #2
0
ファイル: FileClassifier.cs プロジェクト: dox0/DotNet471RS3
        //------------------------------------------------------
        //
        //  Public Events
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Protected Methods
        //
        //------------------------------------------------------


        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Internal Properties
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Internal Events
        //
        //------------------------------------------------------


        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        //
        // Verify all the propety values set from project file.
        // If any input value is set wrongly, report appropriate build error
        // and return false.
        //
        private bool VerifyTaskInputs()
        {
            bool bValidInput = true;

            //
            // Verify different property values
            //
            // OutputType is marked as Required, it should never be null or emtpy.
            // otherwise, the task should have been failed before the code goes here.

            string targetType = OutputType.ToLowerInvariant( );

            switch (targetType)
            {
            case SharedStrings.Library:
            case SharedStrings.Module:
            case SharedStrings.WinExe:
            case SharedStrings.Exe:
                break;

            default:
                Log.LogErrorWithCodeFromResources(SRID.TargetIsNotSupported, targetType);
                bValidInput = false;
                break;
            }

            // SourceFiles property is marked as Required.
            // MSBUILD Engine should have checked the setting for this property
            // so don't need to recheck here.

            if (TaskHelper.IsValidCultureName(Culture) == false)
            {
                Log.LogErrorWithCodeFromResources(SRID.InvalidCulture, Culture);
                bValidInput = false;
            }

            return(bValidInput);
        }