} // This is True if the SGEN command line exceeds 32,000 characters and is therefore split into "SGenCommandLineParameters" and "SGenCommandLineParametersContinued". public override bool Execute() { ILogger logger = new LoggerThatUsesTaskOutput(this); string operationName = "C#/XAML for HTML5: SerializationAssembliesGenerator"; try { // Retrieve the full path of sgen.exe: string sgenFullPath; if (!GeneratingSerializationAssemblies.TryGetLocationOfSGenExe(out sgenFullPath) || string.IsNullOrEmpty(sgenFullPath)) { throw new Exception("Could not find the file sgen.exe: please contact [email protected] or ignore this error by adding the following line to your CSPROJ file: <CSharpXamlForHtml5SkipSerializationAssemblies>True</CSharpXamlForHtml5SkipSerializationAssemblies>"); } // Retrieve its directory: var sgenDirectoryLongPath = Path.GetDirectoryName(sgenFullPath); if (string.IsNullOrEmpty(sgenDirectoryLongPath)) { throw new Exception("Unable to generate short 8.3 path from long path: please report this issue to [email protected]"); } // Convert that directory to the short 8.3-filenames format, so that we don't need to surround the path with double quotes (which don't work with the MSBuild Exec tasc): SGenDirectory = ShortPathHelper.GetShortPathName(sgenDirectoryLongPath); // Generate command line parameters: string sgenCommandLineParameters; string sgenCommandLineParametersContinued; bool sgenIsContinued; bool isSuccess = GeneratingSerializationAssemblies.GenerateSgenCommandLineParameters(IntermediateOutputDirectory, SourceAssembly, new LoggerThatUsesTaskOutput(this), IsBridgeBasedVersion, out sgenCommandLineParameters, out sgenCommandLineParametersContinued, out sgenIsContinued); SGenCommandLineParameters = sgenCommandLineParameters; SGenCommandLineParametersContinued = sgenCommandLineParametersContinued; SGenIsContinued = sgenIsContinued; return(isSuccess); } catch (ReflectionTypeLoadException ex) { logger.WriteError(operationName + " failed. " + Environment.NewLine + Environment.NewLine + "LOADER EXCEPTIONS:" + Environment.NewLine + Environment.NewLine + ConvertLoaderExceptionsToString(ex) + Environment.NewLine + Environment.NewLine + "GENERAL EXCEPTION:" + Environment.NewLine + Environment.NewLine + ex.ToString()); return(false); } catch (Exception ex) { logger.WriteError(operationName + " failed : " + ex.ToString()); return(false); } }
public override bool Execute() { ILogger logger = new LoggerThatUsesTaskOutput(this); string operationName = "C#/XAML for HTML5: SerializationAssembliesProcessor"; try { string fileToIncludeInProject; bool isSuccess = GeneratingSerializationAssemblies.ProcessSourceCode(IntermediateOutputDirectory, SGenIsContinued, logger, out fileToIncludeInProject); FileToIncludeInProject = fileToIncludeInProject; return(isSuccess); } catch (Exception ex) { logger.WriteError(operationName + " failed: " + ex.ToString()); return(false); } }