Cannot add part for the specified URI because it is already in the package

ぐ巨炮叔叔 提交于 2019-12-05 03:36:13

I had the same error but there were no issues in the csproj file. I was using typescript and was accidentally checking in the .js files. So at run-time another js file was being generated, thus there were two of each js files being added.

I found it by going through the team city build log and looking for duplicates. As they were "do not copy" there was no issue with a simple msbuild but as we just switched to using Octopack, cannot add multiple when nugeting a solution.....

You can find the culprit (typescript or otherwise) as it will be the first to appear after the "attempting to create line" (there could be many but finding them on at a time could be easier than doing it manually)

Edit the project file and make sure you do not have duplicate Reference Incudes or duplicate Content Includes. My issue was I had...

    <Reference Include="SCS.PickList, Version=1.7.0.0, Culture=neutral, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>Bin\SCS.PickList.dll</HintPath>
</Reference>

AND

<Content Include="Bin\SCS.PickList.dll" />

Once I removed the Content include it worked.

abjinugu

One possible problem could be that Octopack is actually case sensitive. In my case VS Project had reference to the file with name in lower case letters such as this

In my .nuspec file I had the lines equivalent to:

<file src="Source\MyCompany.ProjectA\**\*.cs" target="src" />
<file src="Source\MyCompany.ProjectB\**\*.cs" target="src" />

I got the error due to the AssemblyInfo.cs file being in both projects.

(This was to enable the creation of a NuGet Symbol Package.)

For me, it was because my files didn't have extensions.

<file src=".\LICENSE" target="" />
<file src=".\NOTICE" target="" />

My solution was to add a wildcard to the end of the file:

<file src=".\LICENSE*" target="" />
<file src=".\NOTICE*" target="" />

In your nuspec file do you have a file node specified?

<files>
    <file src="the_dll_for_your_csproj"/>
</files>

If so, is it possible that you have included (either explicitly or by wildcard) the dll for the csproj you are trying to build?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!