I facing a problem while adding the reference for another project. It gives me an error for adding the Nuspec 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 path 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 to add /p:Nuspecfile=Nuget/ProjectA.nuspec with msbuild /t:pack?I already added 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)?
As per Microsft guidelines, I used this command.
https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#packing-using-a-nuspec-filePacking using a .nuspec file
I removed the /p:Nuspecfile=Nuget/ProjectA.nuspec from the msbuild command and no error and I dont need to add any nuspec file in project B. I am not sure is it right approach or not.