Compartir a través de


IVsMSBuildTaskFileManager.PutGeneratedFileContents Method

Puts the contents of a generated file into an in-memory buffer and registers it in the RDT.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.9.0 (in Microsoft.VisualStudio.Shell.Interop.9.0.dll)

Syntax

'Declaration
Function PutGeneratedFileContents ( _
    wszFilename As String, _
    wszFileContents As String _
) As Integer
int PutGeneratedFileContents(
    string wszFilename,
    string wszFileContents
)
int PutGeneratedFileContents(
    [InAttribute] String^ wszFilename, 
    [InAttribute] String^ wszFileContents
)
abstract PutGeneratedFileContents : 
        wszFilename:string * 
        wszFileContents:string -> int
function PutGeneratedFileContents(
    wszFilename : String, 
    wszFileContents : String
) : int

Parameters

  • wszFilename
    Type: String

    [in] The name of the generated file.

  • wszFileContents
    Type: String

    [in] The contents of the generated file.

Return Value

Type: Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Returns E_FAIL if the document is in the RDT and something else has a lock on it which cannot be removed automatically.

Remarks

This method puts the contents for the generated file into an in memory TextBuffer and registers it in the RDT with a RDT_ReadLock. This holds the file open in memory until the project is closed (when the project will call Close). If this is an actual build operation (such as if UICONTEXT_SolutionBuilding is on) then the file will also be saved to disk. If the generation is at design time for Intellisense purposes then the file contents are only put into memory and the disk is not modified. The in-memory TextBuffer is always marked as clean so the user will not be prompted to save the generated file.

COM Signature

From vsshell90.idl:

HRESULT PutGeneratedFileContents(
    [in] LPCOLESTR wszFilename,
    [in] LPCOLESTR wszFileContents
);

.NET Framework Security

See Also

Reference

IVsMSBuildTaskFileManager Interface

Microsoft.VisualStudio.Shell.Interop Namespace