C
C#4mo ago
NeRooN

My NuGet packages are not created

Hello, I'm trying to create a NuGet package and create it directly in a shared folder. The thing is that this library has multiple target frameworks, and when i create the NuGet it doesnt create the .nupkg file in the PublishDir folder. I've tried with only 1 target framework and it works, so it looks like targeting multiple frameworks is the problem here. This is the config of the .csproj:
<PropertyGroup>
<TargetFrameworks>netcoreapp31;net60</TargetFrameworks>
<LangVersion>7.1</LangVersion>
<VersionPrefix>1.0.0</VersionPrefix>
<!--<VersionSuffix>rc.1</VersionSuffix>-->
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netcoreapp31;net60</TargetFrameworks>
<LangVersion>7.1</LangVersion>
<VersionPrefix>1.0.0</VersionPrefix>
<!--<VersionSuffix>rc.1</VersionSuffix>-->
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>
and the FolderProfile.pubxml:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>\\dev\NuGet</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net60</TargetFramework>
</PropertyGroup>
</Project>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>\\dev\NuGet</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net60</TargetFramework>
</PropertyGroup>
</Project>
as i mentioned, if i change this line:
<TargetFrameworks>netcoreapp31;net60</TargetFrameworks>
<TargetFrameworks>netcoreapp31;net60</TargetFrameworks>
for this:
<TargetFramework>net60</TargetFramework>
<TargetFramework>net60</TargetFramework>
the nupkg file is created under \dev\NuGet Any idea?
60 Replies
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
no, i just right click the project > publish
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
yes in publish all
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
as i mentioned, if i change this line:
<TargetFrameworks>netcoreapp31;net60</TargetFrameworks>
<TargetFrameworks>netcoreapp31;net60</TargetFrameworks>
for this:
<TargetFramework>net60</TargetFramework>
<TargetFramework>net60</TargetFramework>
the nupkg is generated in the folder its a class of libraries or smth like that
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
not sure the translation
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
but if i set it to " <TargetFramework>net60</TargetFramework>" even with the "60" instead of "6.0", its working
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
No description
No description
NeRooN
NeRooN4mo ago
i just do this, and it should generate the nuget package if i target only 1 framework:
<TargetFramework>net60</TargetFramework>
<TargetFramework>net60</TargetFramework>
the nupkg is generated in the folder if i reference multiple frameworks, it only gets generated in /bin/release
NeRooN
NeRooN4mo ago
No description
viceroypenguin
viceroypenguin4mo ago
look. tebe has told you several times. the proper value to go into TargetFramework and TargetFrameworks is net6.0. the best way to get a nuget package is to do dotnet pack from the command line. if you do this, then the package should be generated in the expected location. note, you cannot use the dotnet build system to put it into a shared folder for consumption. you have to build it, and then use nuget install to put it into the shared location. otherwise, it will not end up in the proper subfolder of the shared location. also, why are you trying to support netcoreapp3.1? it is long out of support.
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX4mo ago
TeBeCo
library:
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>$(SolutionDir)artifacts</PackageOutputPath>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix Condition=" '$(Configuration)' == 'DEBUG' " >$([System.DateTime]::Now.ToString(yyyyMMddhhmm))</VersionSuffix>
</PropertyGroup>
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>$(SolutionDir)artifacts</PackageOutputPath>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix Condition=" '$(Configuration)' == 'DEBUG' " >$([System.DateTime]::Now.ToString(yyyyMMddhhmm))</VersionSuffix>
</PropertyGroup>
then to set the feed from the consumer code you can choose EITHER * via a something.props:
<RestoreSources>
$(RestoreSources);
path/to/artifacts
</RestoreSources>
<RestoreSources>
$(RestoreSources);
path/to/artifacts
</RestoreSources>
* via nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="local" value="C:/path/to/artifact" />
</packageSources>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="local" value="C:/path/to/artifact" />
</packageSources>
</configuration>
Quoted by
React with ❌ to remove this embed.
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
yeah, i know he told me, i just said that net60 is working fine as long as i taget only 1 framework. Also as i can see and understand i should avoid using "Publish", instead i need to dotnet pack? the idea on the suffix version is to have some release candidates until we close the version so its the 1.0.0, then start again with 1.1-rc.1 and so on <PackageOutputPath>$(SolutionDir)artifacts</PackageOutputPath> also what does this "artifacts" mean?
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
the own solution dir i assume xD but i want to create it in another dir
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
i already set to "6.0"
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
should this work?
<VersionSuffix Condition=" '$(Configuration)' == 'DEBUG' " >$([System.DateTime]::Now.ToString(yyyyMMddhhmm))</VersionSuffix>
<VersionSuffix Condition=" '$(Configuration)' == 'RELEASE' " >rc.1</VersionSuffix>
<VersionSuffix Condition=" '$(Configuration)' == 'DEBUG' " >$([System.DateTime]::Now.ToString(yyyyMMddhhmm))</VersionSuffix>
<VersionSuffix Condition=" '$(Configuration)' == 'RELEASE' " >rc.1</VersionSuffix>
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
ok, it created this:
No description
NeRooN
NeRooN4mo ago
is it ok? or it should have some other dlls? like this:
NeRooN
NeRooN4mo ago
No description
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
idk
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
oh ok
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
instead of: <PackageOutputPath>$(SolutionDir)artifacts</PackageOutputPath> can i do:
<PackageOutputPath>\\dev\NuGet\MyPackageName</PackageOutputPath>
<PackageOutputPath>\\dev\NuGet\MyPackageName</PackageOutputPath>
and automate the package name somehow? so i can copy paste it to another projects?
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
dont need that, it worked with only 2 \\
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
it generated the nupkg with just \\dev\NuGet
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
okay
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
gitlab, we are still waiting for a place to put them but we need to start working with nuget asap so its a temporal solution
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
thing here is: when i compile my project it will create the nupkg, i assume thats why you set it to debug and set the current time as suffix but what happen if i want to compile in release and i dont change the version first? it will just override it and that can cause troubles, right?
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
i just realised ovber "Publish" there's a "pack":
No description
NeRooN
NeRooN4mo ago
so i can just:
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
and manually pack it
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
i prefer to keep it false, so i can be sure that when i want to package it, i must change the version first in release to rc.x+1
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
okay, ty so much last question. Is it the same for framework 4.7.2? can i do the same in the same way? i just notices the "Publish" or the "Pack" options dont appear in the conetxt menu
NeRooN
NeRooN4mo ago
it's in spanish but no "Publicar" or "Paquete" option appear:
No description
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
i tried but some things didnt worked when using int 472 project idk, they are not even new things, the code is just a copy paste
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
only thing that changed was a visualbasic reference that could be changed to "\t"
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
NeRooN
NeRooN4mo ago
its release x64, not sure how to check if windows only oh, no its not only database access to check something and some loggers will try to reupgrade to 2.0 next day, today im done so really thanks and sorry if im too silly, trying to learn from what i know and seems that i know wrong things!
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server