/// <summary> /// Gets the full path to the compiled output of a <see cref="ConfiguredProject"/>. /// </summary> /// <param name="project">The <see cref="ConfiguredProject"/> whose full ouput assembly path is wanted.</param> /// <returns>The full path of the compiled output assembly of the <paramref name="project"/>.</returns> public static async Task <string> GetProjectOutputPathAsync(ConfiguredProject project) { //... we need to access the target path using reflection (step by step) // get type for ConfiguredProject var projSystemType = project.GetType(); // get private property MSBuildProject var buildProject = projSystemType.GetTypeInfo().GetDeclaredProperty("MSBuildProject"); // get value of MSBuildProject property from ConfiguredProject object // this result is of type Microsoft.Build.Evaluation.Project var projectResult = await((Task <Microsoft.Build.Evaluation.Project>)buildProject.GetValue(project)); // we want the target path property return(projectResult.Properties.First(p => p.Name == "TargetPath").EvaluatedValue); }
public static IAsyncProject CreateAsyncProject(ConfiguredProject configuredProject) { var version = configuredProject.GetType().Assembly.GetName().Version; return(LoadImpl <IAsyncProject>(version, configuredProject)); }