共用方式為


IVsMSBuildTaskFileManager.PutGeneratedFileContents(String, String) Method

Definition

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

public:
 int PutGeneratedFileContents(System::String ^ wszFilename, System::String ^ wszFileContents);
public:
 int PutGeneratedFileContents(Platform::String ^ wszFilename, Platform::String ^ wszFileContents);
int PutGeneratedFileContents(std::wstring const & wszFilename, std::wstring const & wszFileContents);
public int PutGeneratedFileContents (string wszFilename, string wszFileContents);
abstract member PutGeneratedFileContents : string * string -> int
Public Function PutGeneratedFileContents (wszFilename As String, wszFileContents As String) As Integer

Parameters

wszFilename
String

[in] The name of the generated file.

wszFileContents
String

[in] The contents of the generated file.

Returns

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  
);  

Applies to