Can dotnet pack create a nuget package without adding content files from other nuget packages?
up vote
0
down vote
favorite
I'm trying to setup a library nuget package for .net core with the dotnet pack
command, however, instead of just having a dll included in the nuget package, a content file from another references nuget is added (which makes the nuget file size 9.6MB instead of 59KB).
Is there a way to avoid getting files and content from other nuget packages in a nuget library project?
to reproduce:
Create a .net core library
Add Hl7.Fhir.Specification.STU3 nuget reference
run dotnet pack
The nuspec file in the newly created nuget package, will reveal that the specification.zip file is regarded as content that must be added.
I've tried testing with a custom nuspec file which is basicly a copy from the dotnet output, but without the content reference. The problem I see, is that the nuspec file contains a lot of references which must be maintained somehow.
c# .net nuget pack
add a comment |
up vote
0
down vote
favorite
I'm trying to setup a library nuget package for .net core with the dotnet pack
command, however, instead of just having a dll included in the nuget package, a content file from another references nuget is added (which makes the nuget file size 9.6MB instead of 59KB).
Is there a way to avoid getting files and content from other nuget packages in a nuget library project?
to reproduce:
Create a .net core library
Add Hl7.Fhir.Specification.STU3 nuget reference
run dotnet pack
The nuspec file in the newly created nuget package, will reveal that the specification.zip file is regarded as content that must be added.
I've tried testing with a custom nuspec file which is basicly a copy from the dotnet output, but without the content reference. The problem I see, is that the nuspec file contains a lot of references which must be maintained somehow.
c# .net nuget pack
1
Could excluding assets of the referenced package do the Job? I'm not sure if it applies to .zip-files also, have only seen excluding .cs-files. docs.microsoft.com/en-us/nuget/consume-packages/…
– Peter Wurzinger
Nov 8 at 11:26
I just tested it and I couldn't make it work.
– Verzada
Nov 8 at 12:53
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to setup a library nuget package for .net core with the dotnet pack
command, however, instead of just having a dll included in the nuget package, a content file from another references nuget is added (which makes the nuget file size 9.6MB instead of 59KB).
Is there a way to avoid getting files and content from other nuget packages in a nuget library project?
to reproduce:
Create a .net core library
Add Hl7.Fhir.Specification.STU3 nuget reference
run dotnet pack
The nuspec file in the newly created nuget package, will reveal that the specification.zip file is regarded as content that must be added.
I've tried testing with a custom nuspec file which is basicly a copy from the dotnet output, but without the content reference. The problem I see, is that the nuspec file contains a lot of references which must be maintained somehow.
c# .net nuget pack
I'm trying to setup a library nuget package for .net core with the dotnet pack
command, however, instead of just having a dll included in the nuget package, a content file from another references nuget is added (which makes the nuget file size 9.6MB instead of 59KB).
Is there a way to avoid getting files and content from other nuget packages in a nuget library project?
to reproduce:
Create a .net core library
Add Hl7.Fhir.Specification.STU3 nuget reference
run dotnet pack
The nuspec file in the newly created nuget package, will reveal that the specification.zip file is regarded as content that must be added.
I've tried testing with a custom nuspec file which is basicly a copy from the dotnet output, but without the content reference. The problem I see, is that the nuspec file contains a lot of references which must be maintained somehow.
c# .net nuget pack
c# .net nuget pack
asked Nov 8 at 10:27
Verzada
7119
7119
1
Could excluding assets of the referenced package do the Job? I'm not sure if it applies to .zip-files also, have only seen excluding .cs-files. docs.microsoft.com/en-us/nuget/consume-packages/…
– Peter Wurzinger
Nov 8 at 11:26
I just tested it and I couldn't make it work.
– Verzada
Nov 8 at 12:53
add a comment |
1
Could excluding assets of the referenced package do the Job? I'm not sure if it applies to .zip-files also, have only seen excluding .cs-files. docs.microsoft.com/en-us/nuget/consume-packages/…
– Peter Wurzinger
Nov 8 at 11:26
I just tested it and I couldn't make it work.
– Verzada
Nov 8 at 12:53
1
1
Could excluding assets of the referenced package do the Job? I'm not sure if it applies to .zip-files also, have only seen excluding .cs-files. docs.microsoft.com/en-us/nuget/consume-packages/…
– Peter Wurzinger
Nov 8 at 11:26
Could excluding assets of the referenced package do the Job? I'm not sure if it applies to .zip-files also, have only seen excluding .cs-files. docs.microsoft.com/en-us/nuget/consume-packages/…
– Peter Wurzinger
Nov 8 at 11:26
I just tested it and I couldn't make it work.
– Verzada
Nov 8 at 12:53
I just tested it and I couldn't make it work.
– Verzada
Nov 8 at 12:53
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Peter Wurzinger's suggestion worked for me. It's a shame he posted as a comment, rather than an answer, since he deserves the rep points. Anyway, this is my csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hl7.Fhir.Specification.STU3" Version="0.96.0" ExcludeAssets="contentFiles" />
</ItemGroup>
</Project>
when I pack, the binDebugtest.1.0.0.nuspec
file does not contain the specification.zip file elements that exists when I don't use ExcludeAssets
.
Ah alright, so it seems that arbitrary files can indeed be excluded using ExcludeAssets - good to know!
– Peter Wurzinger
Nov 8 at 18:53
well, it excludes all contentFiles from the package. If you had a package with multiple contentFiles and you want to keep some and exclude others, it would be more difficult.
– Ziv
Nov 8 at 19:50
I didin't set ExcludeAssets="contentFiles", but to "all", so that's where my mistake was.
– Verzada
Nov 9 at 8:30
The package size went from 9.5MB to 28KB, so the setting really matters in the cases where you get content files included from a referenced package
– Verzada
Nov 9 at 8:44
Maybe NuGet ignoresExcludeAssets="all"
, because semantically that's the same as not referencing the package at all, so it's unlikely to ever be what the user wants (you can comment out the line if you want to remove it temporarily without removing it from the file).
– Ziv
Nov 9 at 13:24
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Peter Wurzinger's suggestion worked for me. It's a shame he posted as a comment, rather than an answer, since he deserves the rep points. Anyway, this is my csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hl7.Fhir.Specification.STU3" Version="0.96.0" ExcludeAssets="contentFiles" />
</ItemGroup>
</Project>
when I pack, the binDebugtest.1.0.0.nuspec
file does not contain the specification.zip file elements that exists when I don't use ExcludeAssets
.
Ah alright, so it seems that arbitrary files can indeed be excluded using ExcludeAssets - good to know!
– Peter Wurzinger
Nov 8 at 18:53
well, it excludes all contentFiles from the package. If you had a package with multiple contentFiles and you want to keep some and exclude others, it would be more difficult.
– Ziv
Nov 8 at 19:50
I didin't set ExcludeAssets="contentFiles", but to "all", so that's where my mistake was.
– Verzada
Nov 9 at 8:30
The package size went from 9.5MB to 28KB, so the setting really matters in the cases where you get content files included from a referenced package
– Verzada
Nov 9 at 8:44
Maybe NuGet ignoresExcludeAssets="all"
, because semantically that's the same as not referencing the package at all, so it's unlikely to ever be what the user wants (you can comment out the line if you want to remove it temporarily without removing it from the file).
– Ziv
Nov 9 at 13:24
add a comment |
up vote
1
down vote
accepted
Peter Wurzinger's suggestion worked for me. It's a shame he posted as a comment, rather than an answer, since he deserves the rep points. Anyway, this is my csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hl7.Fhir.Specification.STU3" Version="0.96.0" ExcludeAssets="contentFiles" />
</ItemGroup>
</Project>
when I pack, the binDebugtest.1.0.0.nuspec
file does not contain the specification.zip file elements that exists when I don't use ExcludeAssets
.
Ah alright, so it seems that arbitrary files can indeed be excluded using ExcludeAssets - good to know!
– Peter Wurzinger
Nov 8 at 18:53
well, it excludes all contentFiles from the package. If you had a package with multiple contentFiles and you want to keep some and exclude others, it would be more difficult.
– Ziv
Nov 8 at 19:50
I didin't set ExcludeAssets="contentFiles", but to "all", so that's where my mistake was.
– Verzada
Nov 9 at 8:30
The package size went from 9.5MB to 28KB, so the setting really matters in the cases where you get content files included from a referenced package
– Verzada
Nov 9 at 8:44
Maybe NuGet ignoresExcludeAssets="all"
, because semantically that's the same as not referencing the package at all, so it's unlikely to ever be what the user wants (you can comment out the line if you want to remove it temporarily without removing it from the file).
– Ziv
Nov 9 at 13:24
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Peter Wurzinger's suggestion worked for me. It's a shame he posted as a comment, rather than an answer, since he deserves the rep points. Anyway, this is my csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hl7.Fhir.Specification.STU3" Version="0.96.0" ExcludeAssets="contentFiles" />
</ItemGroup>
</Project>
when I pack, the binDebugtest.1.0.0.nuspec
file does not contain the specification.zip file elements that exists when I don't use ExcludeAssets
.
Peter Wurzinger's suggestion worked for me. It's a shame he posted as a comment, rather than an answer, since he deserves the rep points. Anyway, this is my csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hl7.Fhir.Specification.STU3" Version="0.96.0" ExcludeAssets="contentFiles" />
</ItemGroup>
</Project>
when I pack, the binDebugtest.1.0.0.nuspec
file does not contain the specification.zip file elements that exists when I don't use ExcludeAssets
.
answered Nov 8 at 15:46
Ziv
669416
669416
Ah alright, so it seems that arbitrary files can indeed be excluded using ExcludeAssets - good to know!
– Peter Wurzinger
Nov 8 at 18:53
well, it excludes all contentFiles from the package. If you had a package with multiple contentFiles and you want to keep some and exclude others, it would be more difficult.
– Ziv
Nov 8 at 19:50
I didin't set ExcludeAssets="contentFiles", but to "all", so that's where my mistake was.
– Verzada
Nov 9 at 8:30
The package size went from 9.5MB to 28KB, so the setting really matters in the cases where you get content files included from a referenced package
– Verzada
Nov 9 at 8:44
Maybe NuGet ignoresExcludeAssets="all"
, because semantically that's the same as not referencing the package at all, so it's unlikely to ever be what the user wants (you can comment out the line if you want to remove it temporarily without removing it from the file).
– Ziv
Nov 9 at 13:24
add a comment |
Ah alright, so it seems that arbitrary files can indeed be excluded using ExcludeAssets - good to know!
– Peter Wurzinger
Nov 8 at 18:53
well, it excludes all contentFiles from the package. If you had a package with multiple contentFiles and you want to keep some and exclude others, it would be more difficult.
– Ziv
Nov 8 at 19:50
I didin't set ExcludeAssets="contentFiles", but to "all", so that's where my mistake was.
– Verzada
Nov 9 at 8:30
The package size went from 9.5MB to 28KB, so the setting really matters in the cases where you get content files included from a referenced package
– Verzada
Nov 9 at 8:44
Maybe NuGet ignoresExcludeAssets="all"
, because semantically that's the same as not referencing the package at all, so it's unlikely to ever be what the user wants (you can comment out the line if you want to remove it temporarily without removing it from the file).
– Ziv
Nov 9 at 13:24
Ah alright, so it seems that arbitrary files can indeed be excluded using ExcludeAssets - good to know!
– Peter Wurzinger
Nov 8 at 18:53
Ah alright, so it seems that arbitrary files can indeed be excluded using ExcludeAssets - good to know!
– Peter Wurzinger
Nov 8 at 18:53
well, it excludes all contentFiles from the package. If you had a package with multiple contentFiles and you want to keep some and exclude others, it would be more difficult.
– Ziv
Nov 8 at 19:50
well, it excludes all contentFiles from the package. If you had a package with multiple contentFiles and you want to keep some and exclude others, it would be more difficult.
– Ziv
Nov 8 at 19:50
I didin't set ExcludeAssets="contentFiles", but to "all", so that's where my mistake was.
– Verzada
Nov 9 at 8:30
I didin't set ExcludeAssets="contentFiles", but to "all", so that's where my mistake was.
– Verzada
Nov 9 at 8:30
The package size went from 9.5MB to 28KB, so the setting really matters in the cases where you get content files included from a referenced package
– Verzada
Nov 9 at 8:44
The package size went from 9.5MB to 28KB, so the setting really matters in the cases where you get content files included from a referenced package
– Verzada
Nov 9 at 8:44
Maybe NuGet ignores
ExcludeAssets="all"
, because semantically that's the same as not referencing the package at all, so it's unlikely to ever be what the user wants (you can comment out the line if you want to remove it temporarily without removing it from the file).– Ziv
Nov 9 at 13:24
Maybe NuGet ignores
ExcludeAssets="all"
, because semantically that's the same as not referencing the package at all, so it's unlikely to ever be what the user wants (you can comment out the line if you want to remove it temporarily without removing it from the file).– Ziv
Nov 9 at 13:24
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205824%2fcan-dotnet-pack-create-a-nuget-package-without-adding-content-files-from-other-n%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Could excluding assets of the referenced package do the Job? I'm not sure if it applies to .zip-files also, have only seen excluding .cs-files. docs.microsoft.com/en-us/nuget/consume-packages/…
– Peter Wurzinger
Nov 8 at 11:26
I just tested it and I couldn't make it work.
– Verzada
Nov 8 at 12:53