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

Including native libraries in dotnet projects without nuget package #7017

Closed
nicolasr75 opened this issue Oct 24, 2016 · 5 comments
Closed
Milestone

Comments

@nicolasr75
Copy link

According to the current documentation the packOptions would allow us to specify a native library for inclusion in a nuget package. Wouldn't it be great if we could have something similar for a normal app publish? That would allow us to bypass the creation of a nuget package for simple scenarios.

For example:

"packOptions":{
    "files":{
        "mappings":{
            "runtimes/win10-x64/native":{
                "includeFiles":[ "native-lib.dll"]
            }
        }            
    }
}

From my tests it looks like packOptions is not considered by dotnet publish.

https://docs.microsoft.com/de-de/dotnet/articles/core/tutorials/libraries

@blackdwarf
Copy link

MSBuild allows this very easily using the <Content> element. Is this what is looked for here?

@tmds
Copy link
Member

tmds commented Jan 13, 2017

From my tests it looks like packOptions is not considered by dotnet publish.

@nicolasr75 try using publishOptions (see https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json)

@nicolasr75
Copy link
Author

@tmds thanks, indeed it seems to be as easy as

"publishOptions": {
    "include": [
		"My.dll"
	]
}

I somehow thought I'd have to create all the runtime directories dynamically and copy the DLL to all of them. In my case the DLL is the same for all runtimes and it works by simply copying it to the publish base directory.

@nicolasr75
Copy link
Author

nicolasr75 commented Jan 15, 2017

@blackdwarf yes, I guess <Content> may work. I will try it as soon as I port the project to VS2017.

@blackdwarf
Copy link

@nicolasr75 I will assume that this worked since MSbuild's <Content> is tried and true so will therefore close this issue. :) If you run into problems or it doesn't work, please reopen.

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

No branches or pull requests

4 participants