Forum Topics not found
devman 05 Sep 2023, 07:46 ( Updated at: 06 Sep 2023, 05:16 )
josef.van.niekerk said:
I find this rather counterproductive. It's not uncommon for .NET solutions to contain multiple projects.…
I find this rather counterproductive. It's not uncommon for .NET solutions to contain multiple projects.
…
Try this solution:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net6.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <AlgoPublish>false</AlgoPublish> </PropertyGroup> <ItemGroup> <PackageReference Include="cTrader.Automate" Version="1.0.8" /> </ItemGroup> <Target Name="CopyAlgo" Condition="'$(AlgoOut)' != ''" DependsOnTargets="Build;$(_CoreAlgoBuildTargets)"> <ItemGroup> <_AlgoFile Include="$(_AlgoFilePath)" /> </ItemGroup> <Copy SourceFiles="@(_AlgoFile)" DestinationFolder="$(AlgoOut)" OverwriteReadOnlyFiles="True" Retries="10" RetryDelayMilliseconds="100" /> <Message Importance="High" Text="$(MSBuildProjectName) -> $(AlgoOut)\$(_AlgoFileName)" /> </Target> </Project>
Run this command:
dotnet build -p:AlgoOut=your\path -t:CopyAlgo
Of course, you can use the full power of MSBuild and create separate .targets file. Like this:
.targets
<!-- FILE: src/copyalgo.target --> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Target Name="CopyAlgo" Condition="'$(AlgoOut)' != ''" DependsOnTargets="Build;$(_CoreAlgoBuildTargets)"> <ItemGroup> <_AlgoFile Include="$(_AlgoFilePath)" /> </ItemGroup> <Copy SourceFiles="@(_AlgoFile)" DestinationFolder="$(AlgoOut)" OverwriteReadOnlyFiles="True" Retries="10" RetryDelayMilliseconds="100" /> <Message Importance="High" Text="$(MSBuildProjectName) -> $(AlgoOut)\$(_AlgoFileName)" /> </Target> </Project>
Import this file in your projects, or use Directory.Build.props to generalize this customization.
Directory.Build.props
<Project> ... <Import Project="..\..\src\copyalgo.targets" /> ... </Project>
devman
05 Sep 2023, 07:46 ( Updated at: 06 Sep 2023, 05:16 )
RE: RE: C# solution with multiple bots / indicators, a.k.a. monorepo...
josef.van.niekerk said:
Try this solution:
Run this command:
Of course, you can use the full power of MSBuild and create separate
.targets
file. Like this:Import this file in your projects, or use
Directory.Build.props
to generalize this customization.@devman