Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Can't figure out how to include the source code into the nuget package that gets generated

$
0
0

I have several projects in a solution that i want to be packaged to be used as libraries in other solutions. The goal is to make development and debugging seamless, as if it was all in the same solution.

Specifically, I want to be able to ctrl + click on something from the library and be able to view the original source code and not the decompiled code.

I am using PackageReference to include the libraries to the application. What I have noticed is that when I unzip either the nupkg or snupkg, there is no source files anywhere. On that note, I have searched all over the internet and found conflicting things about where the source files go in the nupkg. I have seen mentions of the following folders in the nupkg: lib, src, content, and contentFiles. Which one should actually contain the source code?

When I unzip the nupkg (or snupkg) the only things I have in it are _rels, lib, package, [Content_Types].xml, and PROJECTNAME.nuspec.

I see that the lib folder contains the dll and the pdb file but no source code.Furthermore, I noticed that the snupkg file is considerably smaller than the nupkg file which I find to be counter intuitive.

I have tried packaging usingmsbuild -t:packmsbuild -t:pack -IncludeSource=truenuget packnuget pack -IncludeSource=trueand also building with visual studio but to no avail.

Here is my vbproj file

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /><PropertyGroup><Configuration Condition=" '$(Configuration)' == ''">Debug</Configuration><Platform Condition=" '$(Platform)' == ''">AnyCPU</Platform><ProjectGuid>{C64FB67B-64D0-4607-AE35-A21888FE79A2}</ProjectGuid><OutputType>Library</OutputType><RootNamespace>ROOTNAMESPACE_HERE</RootNamespace><AssemblyName>PACKAGE_NAME_HERE.ROOTNAMESPACE_HERE</AssemblyName><FileAlignment>512</FileAlignment><MyType>Windows</MyType><TargetFrameworkVersion>v4.8</TargetFrameworkVersion><Deterministic>true</Deterministic><SccProjectName>SAK</SccProjectName><SccLocalPath>SAK</SccLocalPath><SccAuxPath>SAK</SccAuxPath><SccProvider>SAK</SccProvider><TargetFrameworkProfile /><GeneratePackageOnBuild>true</GeneratePackageOnBuild><version>1.0.0</version><RepositoryType>git</RepositoryType><Authors>COMPANY_HERE</Authors><BuildInParallel>false</BuildInParallel><EmbedUntrackedSources>true</EmbedUntrackedSources><IncludeSymbols>true</IncludeSymbols><SymbolPackageFormat>snupkg</SymbolPackageFormat><IncludeSource>true</IncludeSource><PackageId>PACKAGE_NAME_HERE.ROOTNAMESPACE_HERE</PackageId><PublishRepositoryUrl>true</PublishRepositoryUrl><EmbedUntrackedSources>true</EmbedUntrackedSources><AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder></PropertyGroup>  ...  ...  ...<ItemGroup><PackageReference Include="NuGet.Build.Tasks.Pack" Version="6.4.0"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets></PackageReference><PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" /></ItemGroup>

I have also tried using a nuspec file as well but still no success.I am using .net framework 4.8

I have spent the last 3 days banging my head against the wall over this and haven't been able to figure it out. I have googling non-stop and have even been using ChatGPT to help me try and trouble shoot and no matter what I try I cant get it to work.

Any help would be greatly appreciated!


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>