dotnet / dotnet/msbuild

Should we need to pass NugetFile path with msbuild /t:pack ? Though NugetFile path already added to csproj file

Open
#8,344 0 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

I facing a problem while adding the reference for another project. It gives me an error for adding the NuGet file not found in another project. To be clear I have project A (.netcore project) and I want to use project B(.net standard) as a reference. In project A I used **NuspecFile in csproj** file and **GeneratePackageOnBuild = False**. I used this Nuspec file for packaging some .netcore c++ dll. When I used **msbuild /t:pack projectA.csproj /p:Nuspecfile=Nuget/ProjectA.nuspec** command I was getting an error for nuspec file not found in projectB. I added the nuspec file in Project B and I had to build Project B separately. If I remove the /p:Nuspecfile=Nuget/ProjectA.nuspec from msbuild /t:pack command. There is no issue.

My question is should I have add **/p:Nuspecfile=Nuget/ProjectA.nuspec** with msbuild /t:pack?
I already added the NuspecFile in the projectA.csproj file. Do we need to add NuspecFile in csproj and msbuild both or only one place?

What would be the problem If I don't use Nuspec file information in both( csproj and msbuild)?
What is the right approach?

As per Microsft guidelines, I used this command.

https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#packing-using-a-nuspec-file
**Packing using a .nuspec file**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.