The below error is triggered when running MSbuild:
Cannot add part for the specified URI because it is already in the package.
There was an error calling NuGet. Please see the output above for more details. Command line: 'D:\Builds\26\1632\Sources\packages\OctoPack.3.0.31\tools\NuGet.exe' pack "D:\Builds\26\1632\Sources\cDART\obj\octopacking\cDartWeb.nuspec" -NoPackageAnalysis -BasePath "D:\Builds\26\1632\Sources\cDART" -OutputDirectory "D:\Builds\26\1632\Sources\cDART\obj\octopacked" -Version 1.0.0.0
System.Exception: There was an error calling NuGet. Please see the output above for more details. Command line: 'D:\Builds\26\1632\Sources\packages\OctoPack.3.0.31\tools\NuGet.exe' pack "D:\Builds\26\1632\Sources\cDART\obj\octopacking\cDartWeb.nuspec" -NoPackageAnalysis -BasePath "D:\Builds\26\1632\Sources\cDART" -OutputDirectory "D:\Builds\26\1632\Sources\cDART\obj\octopacked" -Version 1.0.0.0 at OctoPack.Tasks.CreateOctoPackPackage.RunNuGet(String specFilePath, String octopacking, String octopacked, String projectDirectory) in y:\work\46cfb6001f03d701\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 520 at OctoPack.Tasks.CreateOctoPackPackage.Execute() in y:\work\46cfb6001f03d701\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 189
Thanks for getting in touch! I am sorry but as the errors you have pasted below specify we require the ‘above output’ to get to the bottom of this.
Are you able to please provide the MSbuild output that is trying to trigger OctoPack.
Please find the detailed error:
D:\Builds\56\1632\Sources\cDART\cDartWeb.csproj (1584): “D:\Builds\56\1632\Sources\packages\OctoPack.3.0.31\tools\OctoPack.targets” cannot be imported again. It was already imported at “D:\Builds\56\1632\Sources\cDART\cDartWeb.csproj (1579,3)”. This is most likely a build authoring error. This subsequent import will be ignored.
D:\Builds\56\1632\Sources\cDART\cDartWeb.csproj (1596): “D:\Builds\56\1632\Sources\packages\OctoPack.3.0.31\tools\OctoPack.targets” cannot be imported again. It was already imported at “D:\Builds\56\1632\Sources\cDART\cDartWeb.csproj (1579,3)”. This is most likely a build authoring error. This subsequent import will be ignored.
D:\Builds\56\1632\Sources\cDARTTestProject\cDARTTestProject.csproj (73): “D:\Builds\56\1632\Sources\packages\OctoPack.3.0.31\tools\OctoPack.targets” cannot be imported again. It was already imported at “D:\Builds\56\1632\Sources\cDARTTestProject\cDARTTestProject.csproj (61,3)”. This is most likely a build authoring error. This subsequent import will be ignored.
1 projects/solutions compiled
No Test Results
No Code Coverage Results
Debug | Any CPU
3 error(s), 301 warning(s)
$/CaptureDART_3499/CaptureDART/Test Branch/cDARTWeb/cDartWeb.sln - 3 error(s), 301 warning(s), View Log File
Cannot add part for the specified URI because it is already in the package.
There was an error calling NuGet. Please see the output above for more details. Command line: ‘D:\Builds\56\1632\Sources\packages\OctoPack.3.0.31\tools\NuGet.exe’ pack “D:\Builds\56\1632\Sources\cDART\obj\octopacking\cDartWeb.nuspec” -NoPackageAnalysis -BasePath “D:\Builds\56\1632\Sources\cDART” -OutputDirectory “D:\Builds\56\1632\Sources\cDART\obj\octopacked” -Version 1.0.0.0
System.Exception: There was an error calling NuGet. Please see the output above for more details. Command line: ‘D:\Builds\56\1632\Sources\packages\OctoPack.3.0.31\tools\NuGet.exe’ pack “D:\Builds\56\1632\Sources\cDART\obj\octopacking\cDartWeb.nuspec” -NoPackageAnalysis -BasePath “D:\Builds\56\1632\Sources\cDART” -OutputDirectory “D:\Builds\56\1632\Sources\cDART\obj\octopacked” -Version 1.0.0.0 at OctoPack.Tasks.CreateOctoPackPackage.RunNuGet(String specFilePath, String octopacking, String octopacked, String projectDirectory) in y:\work\46cfb6001f03d701\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 520 at OctoPack.Tasks.CreateOctoPackPackage.Execute() in y:\work\46cfb6001f03d701\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 189
Thanks for providing those errors. It looks like your csproj file is referencing Octopack multiple times on the following lines: 1584,1596,1579,73,61.
Please look for the following code in this file D:\Builds\56\1632\Sources\cDART\cDartWeb.csproj:
After removing the extra lines one error is removed.
But received the below error:
Cannot add part for the specified URI because it is already in the package.
There was an error calling NuGet. Please see the output above for more details. Command line: ‘D:\Builds\56\1632\Sources\packages\OctoPack.3.0.31\tools\NuGet.exe’ pack “D:\Builds\56\1632\Sources\cDART\obj\octopacking\cDartWeb.nuspec” -NoPackageAnalysis -BasePath “D:\Builds\56\1632\Sources\cDART” -OutputDirectory “D:\Builds\56\1632\Sources\cDART\obj\octopacked” -Version 1.0.0.0
System.Exception: There was an error calling NuGet. Please see the output above for more details. Command line: ‘D:\Builds\56\1632\Sources\packages\OctoPack.3.0.31\tools\NuGet.exe’ pack “D:\Builds\56\1632\Sources\cDART\obj\octopacking\cDartWeb.nuspec” -NoPackageAnalysis -BasePath “D:\Builds\56\1632\Sources\cDART” -OutputDirectory “D:\Builds\56\1632\Sources\cDART\obj\octopacked” -Version 1.0.0.0 at OctoPack.Tasks.CreateOctoPackPackage.RunNuGet(String specFilePath, String octopacking, String octopacked, String projectDirectory) in y:\work\46cfb6001f03d701\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 520 at OctoPack.Tasks.CreateOctoPackPackage.Execute() in y:\work\46cfb6001f03d701\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 189
One thing you need to watch out for if you check your /packages/ directory into version control, make SURE your (vcs)ignore file is set to allow ANY extension within /packages/ otherwise you will run into no end of trouble.
For example, our .gitignore had *.exe in it, well Octopack includes something called Nuget.exe, and it doesn’t like it when you clone down your VCS and run a build and it can’t find it’s friend Nuget.exe anywhere. Typically the developer who is currently working on the project isn’t the one that created the .gitignore, or the IDE created it for them, so make sure you are aware of how these often forgotten files are affecting your build process.
This is why we prefer to use the packages.config and intentionally .gitignore the /packages/ directories, that way we can rely on ‘Nuget restore’ to make our builds repeatable across systems.
This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.