共用方式為


IVsTrackProjectRetargeting.OnSetTargetFramework Method

Definition

Called to initiate and orchestrate project retargeting. This method fires various retargeting events at different stages of the retargeting operation.

public:
 int OnSetTargetFramework(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHier, System::String ^ currentTargetFramework, System::String ^ newTargetFramework, Microsoft::VisualStudio::Shell::Interop::IVsSetTargetFrameworkWorkerCallback ^ pWorkerCallback, bool ReloadProject);
public:
 int OnSetTargetFramework(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHier, Platform::String ^ currentTargetFramework, Platform::String ^ newTargetFramework, Microsoft::VisualStudio::Shell::Interop::IVsSetTargetFrameworkWorkerCallback ^ pWorkerCallback, bool ReloadProject);
int OnSetTargetFramework(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy const & pHier, std::wstring const & currentTargetFramework, std::wstring const & newTargetFramework, Microsoft::VisualStudio::Shell::Interop::IVsSetTargetFrameworkWorkerCallback const & pWorkerCallback, bool ReloadProject);
public int OnSetTargetFramework (Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pHier, string currentTargetFramework, string newTargetFramework, Microsoft.VisualStudio.Shell.Interop.IVsSetTargetFrameworkWorkerCallback pWorkerCallback, bool ReloadProject);
abstract member OnSetTargetFramework : Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * string * string * Microsoft.VisualStudio.Shell.Interop.IVsSetTargetFrameworkWorkerCallback * bool -> int
Public Function OnSetTargetFramework (pHier As IVsHierarchy, currentTargetFramework As String, newTargetFramework As String, pWorkerCallback As IVsSetTargetFrameworkWorkerCallback, ReloadProject As Boolean) As Integer

Parameters

pHier
IVsHierarchy

[in] The hierarchy of the project that needs to be retargeted.

currentTargetFramework
String

[in] The current target framework moniker of the project.

newTargetFramework
String

[in] The target framework moniker to which the project is being retargeted.

pWorkerCallback
IVsSetTargetFrameworkWorkerCallback

[in] The worker callback interface that actually writes the retargeting information in the project file.

ReloadProject
Boolean

[in] true if the caller wants the project to be reloaded (the normal case).

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

When using this method, the normal situation is to call with ReloadProject set to true. If ReloadProject is false, the expectation is that the calling project is ready to deal with the new framework version without a reload.

Applies to