-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
needs-triageHave yet to determine what bucket this goes in.Have yet to determine what bucket this goes in.
Description
I have an API that imports many modules. Here's the code snippet:
<Project Sdk="Microsoft.NET.Sdk.Web">
// rest of the MSBuild code in Api.csproj
<Import Project="/CRM/Ticketing/Module.targets" />
<Import Project="/CRM/Customers/Module.targets" />
<Import Project="/CRM/Loyalty/Module.targets" />
<Import Project="/CRM/Club/Module.targets" />
<Project>
And each of those Module.targets files define two properties and import a base Module.targets file:
/CRM/Customers/Module.targets
<Project>
<PropertyGroup>
<Project>CRM</Project>
<Module>Customers</Module>
</PropertyGroup>
<Import Project="/Base/Module.targets" />
</Project>
/CRM/Club/Module.targets
<Project>
<PropertyGroup>
<Project>CRM</Project>
<Module>Club</Module>
</PropertyGroup>
<Import Project="/Base/Module.targets" />
</Project>
And this is the base Module.targets:
<Project>
<ItemGroup>
<Reference Include="$(Project).$(Module).Models">
<HintPath>/$(Project)/$(Module)/Packages/$(Project).$(Module).Models.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="$(Project).$(Module).DataAccess">
<HintPath>/$(Project)/$(Module)/Packages/$(Project).$(Module).DataAccess.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="$(Project).$(Module).Business">
<HintPath>/$(Project)/$(Module)/Packages/$(Project).$(Module).Business.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="/$(Project)/$(Module)/Database.json">
<Link>Database\$(Module).json</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
So, basically what I'm trying to do is to centralize a module's MSBuild configuration and only provide parameters.
The problem is that MSBuild complains that:
warning MSB4011: "/Base/Module.targets" cannot be imported again. It was already imported at "/CRM/Customers/Project.targets (8,3)". This is most likely a build authoring error. This subsequent import will be ignored. [/CRM/CustomerApi/Api.csproj]
How can I solve this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs-triageHave yet to determine what bucket this goes in.Have yet to determine what bucket this goes in.