-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
execute CoreBuild to generate xaml files #2982
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,8 +54,18 @@ public string GetPropertyValue(string name) | |
|
||
protected async Task<ProjectInstance> BuildAsync(string taskName, MSB.Framework.ITaskHost taskHost, CancellationToken cancellationToken) | ||
{ | ||
// prepare for building | ||
var buildTargets = new BuildTargets(_loadedProject, "Compile"); | ||
// Create a project instance to be executed by build engine. | ||
// The executed project will hold the final model of the project after execution via msbuild. | ||
var executedProject = _loadedProject.CreateProjectInstance(); | ||
|
||
// if the project doesn't have a Compile target, then its not really a vb or c# project. | ||
if (!executedProject.Targets.ContainsKey("Compile")) | ||
{ | ||
return executedProject; | ||
} | ||
|
||
// prepare for building -- use CoreBuild to get xaml generated files | ||
var buildTargets = new BuildTargets(_loadedProject, "CoreBuild"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to write tests for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is already a test, but it is skipped due to redirect problem with MSBuild. We cannot supply the correct redirects to xunit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @KevinH-MS mentioned that you can add a |
||
|
||
// Don't execute this one. It will build referenced projects. | ||
// Even when DesignTimeBuild is defined, it will still add the referenced project's output to the references list | ||
|
@@ -66,22 +76,12 @@ protected async Task<ProjectInstance> BuildAsync(string taskName, MSB.Framework. | |
// already done everything we need to compute compiler inputs by then. | ||
buildTargets.RemoveAfter("CoreCompile", includeTargetInRemoval: false); | ||
|
||
// create a project instance to be executed by build engine. | ||
// The executed project will hold the final model of the project after execution via msbuild. | ||
var executedProject = _loadedProject.CreateProjectInstance(); | ||
|
||
if (!executedProject.Targets.ContainsKey("Compile")) | ||
{ | ||
return executedProject; | ||
} | ||
|
||
var hostServices = new Microsoft.Build.Execution.HostServices(); | ||
|
||
// connect the host "callback" object with the host services, so we get called back with the exact inputs to the compiler task. | ||
hostServices.RegisterHostObject(_loadedProject.FullPath, "CoreCompile", taskName, taskHost); | ||
|
||
var buildParameters = new MSB.Execution.BuildParameters(_loadedProject.ProjectCollection); | ||
|
||
var buildRequestData = new MSB.Execution.BuildRequestData(executedProject, buildTargets.Targets, hostServices); | ||
|
||
var result = await this.BuildAsync(buildParameters, buildRequestData, cancellationToken).ConfigureAwait(continueOnCapturedContext: false); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this code? It doesn't seem to be called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's for debugging the tasks that MSBuild will process.