Created
June 9, 2016 10:09
-
-
Save jrkd/4b60d1cca342ef9b69f37c9bba3a1977 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<UsingTask TaskName="GetProjectsFromSolutionCodeTask" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll"> | |
<ParameterGroup> | |
<Solution ParameterType="System.String" Required="true" /> | |
<Output ParameterType="Microsoft.Build.Framework.ITaskItem[]" Output="true" /> | |
</ParameterGroup> | |
<Task> | |
<Reference Include="System.Xml" /> | |
<Reference Include="Microsoft.Build" /> | |
<Using Namespace="Microsoft.Build.Construction" /> | |
<Code Type="Fragment" Language="cs"><![CDATA[ | |
var _solutionFile = SolutionFile.Parse(Solution); | |
Output = _solutionFile.ProjectsInOrder | |
.Where(proj => proj.ProjectType == SolutionProjectType.KnownToBeMSBuildFormat) | |
.Select(proj => new TaskItem(proj.AbsolutePath)) | |
.ToArray(); | |
]]></Code> | |
</Task> | |
</UsingTask> | |
<Target Name="BeforeBuild" > | |
<GetProjectsFromSolutionCodeTask Solution="$(SolutionPath)"> | |
<Output ItemName="ProjectFiles" TaskParameter="Output" /> | |
</GetProjectsFromSolutionCodeTask> | |
<!-- This message wont be shown until you change settings under 'Buid & run' from minmal --> | |
<Message Condition="true" Importance="High" text="Testing: @(ProjectFiles)"> | |
</Message> | |
</Target> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment