Custom MsBuild task: which solution/other projects are participating in the build?
Tag : chash , By : user143729
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , You could parse the .sln for csprojs (harder since its not xml), but you could parse the csproj for references and dependencies. Here is some example code (that might go into your custom task. string fileName = @"C:\MyFolder\MyProjectFile.csproj";
XDocument xDoc = XDocument.Load(fileName);
XNamespace ns = XNamespace.Get("http://schemas.microsoft.com/developer/msbuild/2003");
//References "By DLL (file)"
var list1 = from list in xDoc.Descendants(ns + "ItemGroup")
from item in list.Elements(ns + "Reference")
/* where item.Element(ns + "HintPath") != null */
select new
{
CsProjFileName = fileName,
ReferenceInclude = item.Attribute("Include").Value,
RefType = (item.Element(ns + "HintPath") == null) ? "CompiledDLLInGac" : "CompiledDLL",
HintPath = (item.Element(ns + "HintPath") == null) ? string.Empty : item.Element(ns + "HintPath").Value
};
foreach (var v in list1)
{
Console.WriteLine(v.ToString());
}
//References "By Project"
var list2 = from list in xDoc.Descendants(ns + "ItemGroup")
from item in list.Elements(ns + "ProjectReference")
where
item.Element(ns + "Project") != null
select new
{
CsProjFileName = fileName,
ReferenceInclude = item.Attribute("Include").Value,
RefType = "ProjectReference",
ProjectGuid = item.Element(ns + "Project").Value
};
foreach (var v in list2)
{
Console.WriteLine(v.ToString());
}
|
MSBuild copy task for all solution outputs without project\bin\configuration
Date : March 29 2020, 07:55 AM
around this issue Have you tried overriding the output path parameter? For example if you call msbuild on each solution C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe $(SolutionName) /p:OutputPath="%CD%\Build"
|
How can I force MSBuild to respect project dependencies in my solution when my project uses a Csc task?
Tag : chash , By : mhedberg
Date : March 29 2020, 07:55 AM
help you fix your problem It appears that the issue was not build order so much as when the wildcards are evaluated. In my example, the CSFile tag is evaluated before the generated .cs files from ProjectA exist, so even though ProjectA happens first, they are not included in the build. <Target Name="BeforeBuild">
<!-- Force project references to build before this, because otherwise it doesn't... -->
<MSBuild Projects="@(ProjectReference)"
Targets="Build"
BuildInParallel="false"
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);%(_MSBuildProjectReferenceExistent.SetPlatform)"
ContinueOnError="false" />
<CreateItem Include="..\ProjectA\generated\$(Platform)\$(Configuration)\cs\*.cs">
<Output ItemName="Compile" TaskParameter="Include" />
</CreateItem>
<CreateItem Include="..\ProjectA\generated\$(Platform)\$(Configuration)\cs\*.cs">
<Output ItemName="GeneratedCS" TaskParameter="Include" />
</CreateItem>
<Message Text="Generated .cs files...%0d @(GeneratedCS->'%(Filename)%(Extension)','%0d ')" Importance="high" />
</Target>
|
Run msbuild post-build task for few projects or solution, and run it once per build
Date : March 29 2020, 07:55 AM
will help you I ended up creating separate empty project, referencing subset of the projects and adding post-build tast: <Target Name="DeployJsPerfFiles" AfterTargets="Build">
<Exec WorkingDirectory="$(WorkgroupDir)" Command="rake suite:deploy" />
</Target>
|
How to build every project in a solution by using msbuild.exe
Date : March 29 2020, 07:55 AM
|