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

Creating package with x86 and x64 managed and native libraries into single package #9272

Closed
KinsonDigital opened this issue Mar 6, 2020 · 2 comments
Labels
Functionality:Pack Partner:MSBuild Resolution:Duplicate This issue appears to be a Duplicate of another issue Type:DCR Design Change Request Type:Docs

Comments

@KinsonDigital
Copy link

Details about Problem

Here is my current setup. I am creating a game engine in C# that uses SDL. There is a popular C# wrapper library that P/Invokes into
the native SDL2 libraries for the purpose of creating games. These native libraries have x86 and x64 architecture versions of them and
I need to to take advantage of both which means my game engine has only x86 and x64 architectures.

What I am trying to do is create a nuget package that contains multiple architectures of not only the native libraries but of my C# game
engine library as well. I have already learned that I can get the native libraries properly put into the package using the csproj file
XML content that is similar to the what you see below.

<Target Name="Add-x64-SDL-Libs" Condition="$(ConfigurationName) == 'Debug'" AfterTargets="Build">
	<ItemGroup>
		<Content Include="$(ProjectDir)SDL\x86\SDL-x86.dll" Pack="true" PackagePath="\runtimes\win10-86\native" />
		<Content Include="$(ProjectDir)SDL\x64\SDL-x64.dll" Pack="true" PackagePath="\runtimes\win10-64\native" />
	</ItemGroup>
</Target>

This will of course put both the x86 and x64 version of the SDL libraries into the package.

The issue I am having is how do I get both architecture versions of my library into the package as well? My thinking is that the consumer of the package
could use my package and either choose x86 or x64 and Visual Studio would just use the proper architecture for the libraries based on the architecture of their project. Is this even feasible?

I thought that maybe I could do 2 separate packages. One for x86 and one for x64, but that does not seem like the right way to do it and I know there are packages out there that have it all in one. One good example is the System.Data.SQLite.Core nuget package which supports many different platforms and architectures.

I dug into the package and seen that they make use of a build directory which I know are additional instructions for MSBuild to use during the build process. I tried finding documentation on this but I cannot find barely any information on the microsoft docs site or anywhere else on the format and use of the .targets files.

I also do not want to take a path that will eventually be getting deprecated or that is not the recommended way of doing it. An example of this is using .nuspec files. I read that using them is not the preferred way of doing this anymore and that it is only used inside of the package, not part of your project.

Again my end goal is to just simply release multiple architectures of my native AND managed libraries in one package and anybody could just consume it, point to the right architecture and then it works.

I have been struggling with this issue for about 2 weeks and even though I have learned a lot, I am coming up to a dead end. Any help is greatly appreciated.


NuGet Product Used: VS UI

VS Version: 16.4.5

OS Version: win10 - v1709.16299.1625

@donnie-msft
Copy link
Contributor

Hi... I'm not the expert on this topic, but did want to point out there's a similar issue here #8623.
If you think it represents your concern, you can upvote it (it already has several) and move your comments there. Otherwise, we can keep a separate discussion here.

@zivkan zivkan added the Resolution:Duplicate This issue appears to be a Duplicate of another issue label Jun 13, 2020
@zivkan
Copy link
Member

zivkan commented Jun 13, 2020

closing as duplicate.

@zivkan zivkan closed this as completed Jun 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Pack Partner:MSBuild Resolution:Duplicate This issue appears to be a Duplicate of another issue Type:DCR Design Change Request Type:Docs
Projects
None yet
Development

No branches or pull requests

3 participants