logo
down
shadow

Using MSBuild task to build another (C++) project in the same solution?


Using MSBuild task to build another (C++) project in the same solution?

Content Index :

Using MSBuild task to build another (C++) project in the same solution?
Tag : visual-studio , By : boonchew
Date : January 12 2021, 08:33 AM

should help you out Yes you are invoking the MSBuild task correctly. But you should not do this. It's bad style. And you are sure to trip up someone in the future with this little trick that is hiding in the .vcxproj file. Specify the dependency the correct way: In the solution file (.sln) and visual studio will make sure that the file gets built in the correct order. If you want more power, you can specify the dependency using a instead of using a solution file, but that's a different topic.
In all my years of working at companies with very large code bases: A trick like this has never been done, and never should.

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

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


Tag : msbuild , By : Andrew Mattie
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


Tag : development , By : Alex S
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


Tag : visual-studio-2008 , By : Rb.Ridge
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • How to enable .gitignore file in private repository in GitHub with GUI
  • How to create an exe for .NetCore service
  • Show tooltip on hover over text
  • Confusion about CUDA installation instructions (What exactly is microsoft visual studio?)
  • How should I include Package References in a VSIX project
  • Group by multiple columns, then order results
  • Visual Studio 2019 not entering break point in Azure Functions local debuging mode
  • How can you create a view as a post deployment script in a SQL Server Database Project?
  • Import error data source of Oracle to Visual Studio (Azure analysys Server)
  • Why the script does not work / the button is not pressed in the web browser (control/component)?
  • Bootstrap 4 library name in Libman (CDNJS) from Visual Studio 2019
  • Is there a way to configure Visual Studio 2019 to display tab groups title on the bottom instead of top (as in VS2017)?
  • Package Manager Console fails to read ConnectionStrings when running Add-Migration
  • Nuget Package - Properties - Path is not set
  • Visual Studio - Automatically convert new lines in code when pasting
  • Why is my App Insights not recording data?
  • Can't create a Team Project for Azure DevOps Server 2019 from Visual Studio 2017
  • How to add child project additional output to publish items with MSBuild?
  • Adding SSIS capability to Visual Studio Enterprise 2017
  • Visual studio push to Github
  • Visual Studio Net Core Web App: No option to output as web app in project properties?
  • How do I update my IntelliCode model in Visual Studio 2019?
  • Microsoft visual studio doesn't show any android emulator or physical device for Xamarin project
  • Nuget: Unable to retrieve results from one or more sources
  • When using WinSCPnet from NuGet, how can I get the executable into a custom output directory without a duplicate of the
  • Setting up botan in visual C++
  • How do I set some project references to CopyLocal = false based on metadata?
  • visual studio keeps adding a _1 to a project name crashing the build
  • Generating the dll file for the solution
  • Adding umbraco folders to build with MsBuild
  • TFS build unable to locate the project file and dlls
  • In Razor Pages with Visual Studio 2019, editing a tag attribute will scramble all tag helper attribute values
  • Why doesn't Visual Studio create an APK when building a Xamarin Forms app?
  • Visual Studio Code Editor Settings
  • Visual Studio 2015 Update 3 (KB3165756) Setup Blocked
  • Xamarin.ios CollectionView Delete and Insert Items
  • What can I scrape off the Visual Studio 2015 installation package (like SQL) and still leave it functional?
  • T4 templates vs TT Templates vs Includes in visual studio
  • function tagged `stdcall` isn't recognized as `stdcall`
  • Converting a Julian Date to datetime in Visual Studio (SSIS Package)
  • QT build fails with NMAKE : fatal error U1077: 'echo' : return code '0x1'
  • Number of query values and destination fields are not the same. Error Message
  • Visual Studio: Is there a keyboard shortcut to jump between code editor window and find results?
  • Visual studio 2013 deploy file on save
  • Angular2=>Angular 5.2 in visual studio 2015 very slow launch after update
  • The build tools for v140 cannot be found
  • Nuget Install always fails after successfull install
  • How does Visual Studio choose which iOS simulator to start?
  • Error reading NuGet.config
  • Missing Microsoft RDLC Report Designer in Visual Studio after installation of Sql server Data Tools
  • How can I run a specific page in my UWP app?
  • uninstall nuget package that no longer exists
  • Visual Studio won't let me add a break point unless there's a comment on the line above
  • How do I know from my VSIX that a build will be followed by a Debug session?
  • Running verbose cmake tests in Visual Studio
  • Stop the installation from a custom action
  • How should I run Unit Test from VisualStudio on an remote test agent on another computer
  • Is there a way to attach with VS2013 to the application under focus?
  • Remove Visual Studio infinite whitespace
  • Visual Studio Cordova App, can't run debugger - Could not locate the appxrecipe file
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com