I have several projects that will be compiled into a single nuget package. Based on a suggestion I got, I am trying to get this under the hood with NoTargets SDK. I have no experience with msbuild
tasks. I have to gather the output of the projects, and copy those assemblies into the proper folder structure for the package. I am stuck at being unable to specify the output. Without the <AdditionalProperties>
the projects are built, but in their respective output folders - and I have not figured out how I can get those locations without hardcoding (I use artifacts). Once I specify the output (no matter how), the build fails at not being able to find the output of the references of those projects (I have a helper project that is referenced by each of these. It is looking for that library in the destination folder I specify).
1>Target MyBuild:1> Target _GetProjectReferenceTargetFrameworkProperties:1> Target ResolveProjectReferences:1> Target ResolveAssemblyReferences:1> Primary reference "StandardHelpers".1> Could not find dependent files. Expected file "D:\Workspace\...\artifacts\bin\SDK\Debug\API\Helpers.dll" does not exist.
So for now, I am trying to get it to be built into the common folder, but maybe there is a much better approach.
<Project Sdk="Microsoft.Build.NoTargets/3.7.0"><PropertyGroup><TargetFramework>net8.0</TargetFramework><GeneratePackageOnBuild>True</GeneratePackageOnBuild><PackageId>$(AssemblyName)</PackageId><Title>My package</Title></PropertyGroup><ItemGroup><None Update="tools\*.ps1" CopyToOutputDirectory="Always" Pack="True" PackagePath="" /></ItemGroup><Target Name="SetNuSpecProperties" BeforeTargets="GenerateNuspec"><PropertyGroup><NuspecProperties>$(NuspecProperties);Version=$(Version);BaseOutputPath=$(OutputPath);PackageReleaseNotes=$(PackageReleaseNotes);configuration=$(Configuration);</NuspecProperties></PropertyGroup></Target> <ItemGroup><ProjectToBuild Include="..\API\API.csproj"><AdditionalProperties>OutDir=$(BaseOutputPath)/$(Configuration)/API/</AdditionalProperties></ProjectToBuild><ProjectToBuild Include="..\Analyzers\Analyzers.csproj"><AdditionalProperties>OutDir=$(BaseOutputPath)/$(Configuration)/analyzer/</AdditionalProperties></ProjectToBuild></ItemGroup><Target Name="MyBuild" AfterTargets="Build"><MSBuild Projects="@(ProjectToBuild)" Properties="Configuration=$(Configuration);Optimize=$(Optimize)" ></MSBuild></Target></Project>