System.Web.Compilation.AssemblyBuilder.GetTempFilePhysicalPath C# (CSharp) Method

GetTempFilePhysicalPath() public method

public GetTempFilePhysicalPath ( string extension ) : string
extension string
return string
		public string GetTempFilePhysicalPath (string extension)
		{
			if (extension == null)
				throw new ArgumentNullException ("extension");

			string newFileName = OutputAssemblyPrefix + "_" + temp_files.Count + "." + extension;
			temp_files.AddFile (newFileName, KeepFiles);

			return newFileName;
		}

Usage Example

        void GenerateSource(bool isSupportedVersion, string filePath, AssemblyBuilder assemblyBuilder, WorkflowService workflowService, out string codeFileName, out bool generatedSource, out string activityName)
        {
            // Get unique file and type name for the workflowservice
            codeFileName = assemblyBuilder.GetTempFilePhysicalPath(assemblyBuilder.CodeDomProvider.FileExtension);

            if (isSupportedVersion)
            {
                activityName = WorkflowServiceHostFactory.GetSupportedVersionGeneratedTypeName(filePath);
            }
            else
            {
                activityName = workflowService.Name.LocalName + "_" + Guid.NewGuid().ToString().Replace("-", "_");
            }            

            TextExpressionCompilerSettings settings = new TextExpressionCompilerSettings
            {
                Activity = workflowService.Body,
                ActivityName = activityName,
                ActivityNamespace = GeneratedNamespace,
                Language = CodeDomProvider.GetLanguageFromExtension(assemblyBuilder.CodeDomProvider.FileExtension),
                GenerateAsPartialClass = false,
                AlwaysGenerateSource = false,
                ForImplementation = false
            };

            TextExpressionCompiler compiler = new TextExpressionCompiler(settings);            

            generatedSource = false;
            using (StreamWriter fileStream = new StreamWriter(codeFileName))
            {
                try
                {
                    generatedSource = compiler.GenerateSource(fileStream);
                }
                catch (Exception ex)
                {
                    if (Fx.IsFatal(ex))
                    {
                        throw;
                    }

                    throw FxTrace.Exception.AsError(new HttpCompileException(SR.XamlBuildProviderExtensionException(ex.Message)));
                }
            }
        }