Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge MTGOSDK.MSBuild and MTGOSDK.Ref projects #16

Closed
Tracked by #12
Qonfused opened this issue Apr 3, 2024 · 1 comment · Fixed by #17
Closed
Tracked by #12

Merge MTGOSDK.MSBuild and MTGOSDK.Ref projects #16

Qonfused opened this issue Apr 3, 2024 · 1 comment · Fixed by #17
Assignees

Comments

@Qonfused
Copy link
Member

Qonfused commented Apr 3, 2024

Within the MTGOSDK.Ref project, a new target should include the built reference assemblies for consumption through the library (without needing explicit references for each DLL):

<!-- Packaging assemblies for NuGet publishing -->
<ItemGroup>
  <Content Include="$(_MTGOSDK_Refs)\*.dll">
    <Pack>true</Pack>
    <PackagePath>lib\$(TargetFramework)</PackagePath>
  </Content>
</ItemGroup>
<!-- Importing MTGOSDK.Ref in a consuming project -->
<PackageReference Include="VidereProject.MTGOSDK.Ref"
                  Version="1.0.0" />

Versus the current setup, which requires bootstrapping the MTGOSDK.Ref project with MTGOSDK.MSBuild (internal project):

<!--
  Bootstrap the MTGOSDK.Ref project to generate reference assemblies for
  the current MTGO version. Due to the way that MSBuild works, this must
  import the MTGOSDK.MSBuild.props file before referencing the project.
-->
<Import Project="..\MTGOSDK.MSBuild\build\MTGOSDK.MSBuild.props" />
<PropertyGroup>
  <MTGOSDK_Refs>$(_MTGOSDK_Refs)\3.4.*.*</MTGOSDK_Refs>
</PropertyGroup>
<ItemGroup>
  <ProjectReference Include="..\MTGOSDK.Ref\MTGOSDK.Ref.csproj"
                    ReferenceOutputAssembly="false" />
  <!--
    Include reference assemblies to compile against the current MTGO version.
    Note that the '_MTGOSDK_Refs' path does not reference the updated version
    subpath as it is only evaluated after building the MTGOSDK.Ref project.
  -->
  <Reference Include="$(MTGOSDK_Refs)\Core.dll" />
  <Reference Include="$(MTGOSDK_Refs)\FlsClient.dll" />
  <Reference Include="$(MTGOSDK_Refs)\MTGOEnumStruct.dll" />
  <Reference Include="$(MTGOSDK_Refs)\WotC.MtGO.Client.Common.dll" />
  <Reference Include="$(MTGOSDK_Refs)\WotC.MtGO.Client.Model.Chat.dll" />
  <Reference Include="$(MTGOSDK_Refs)\WotC.MtGO.Client.Model.Core.dll" />
  <Reference Include="$(MTGOSDK_Refs)\WotC.MtGO.Client.Model.Reference.dll" />
</ItemGroup>
@Qonfused Qonfused changed the title Merge **MTGOSDK.MSBuild** and **MTGOSDK.Ref** projects Merge MTGOSDK.MSBuild and MTGOSDK.Ref projects Apr 3, 2024
@Qonfused
Copy link
Member Author

Qonfused commented Apr 3, 2024

Should look into packaging properties/targets under a buildTransitive folder in the NuGet package (reference).

Bootstrapping MTGO reference assembly generation at project reference and including the directory paths dynamically would avoid needing to publish the reference assemblies in the package. Instead, they can be generated at restore/build-time.

Below is an example of how this can be used in the MTGOSDK library (as well as in consumer applications):

<ItemGroup>
  <!--
    Import the MTGOSDK.Ref project to generate reference assemblies for the
    current MTGO version. Consumers of MTGOSDK should not need to reference
    this project directly as it is imported transitively.
  -->
  <ProjectReference Include="..\MTGOSDK.Ref\MTGOSDK.Ref.csproj"
                    ReferenceOutputAssembly="false" />
  <!--
    Include reference assemblies to compile against the current MTGO version.
  -->
  <Reference Include="Core" />
  <Reference Include="FlsClient" />
  <Reference Include="MTGOEnumStruct" />
  <Reference Include="WotC.MtGO.Client.Common" />
  <Reference Include="WotC.MtGO.Client.Model.Chat" />
  <Reference Include="WotC.MtGO.Client.Model.Core" />
  <Reference Include="WotC.MtGO.Client.Model.Reference" />
</ItemGroup>

@Qonfused Qonfused self-assigned this Apr 3, 2024
Qonfused added a commit that referenced this issue Apr 7, 2024
Moves MTGOSDK.Ref references to MTGOSDK.MSBuild; resolves #16.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant