Quantcast
Channel: WE MOVED to github.com/nuget. This site is not monitored!
Viewing all articles
Browse latest Browse all 7612

Commented Issue: Nuget pack with -Symbols: Wildcard in csproj leads to 'Cannot add part for the specified URI because it is already in the package' error. [2972]

$
0
0
To be honest, I can't determine whether it is a bug in NuGet or client code fault...

**Here is the story**

I have a Visual Studio solution which currently consists of four C# projects. Each of these projects targets a particular version of the .NET Framework (FW4.5, FW3.5, WinPhone 7.1 and WinPhone 8.0). The project that targets .NET Framework 4.5 is a "base" one. All new files are explicitly added to this project while I'm working in Visual Studio. In order to avoid the need of new files tracking and manual adding them to other projects I configured projects to include all the '.cs' files using wildcard in their csproj: `<Compile Include="$(MSBuildProjectDirectory)\**\*.cs" Exclude="$(MSBuildProjectDirectory)\**\obj\**" />`

**Potential bug**

If I try to create just a regular NuGet package everything goes fine. But when I try to pack each version of the project into a NuGet **symbol** package, I receive the following error message:
```
>nuget pack Koteyka.GlobalCs.Fw35.csproj -Version 1.2.3 -Symbols -Verbosity detailed -Prop Configuration=Release -OutputDirectory PackedCompiledProjects

Attempting to build package from 'Koteyka.GlobalCs.Fw35.csproj'.
Packing files from 'c:\WorkspacesNet\Koteyka.GlobalCs\Koteyka.GlobalCs\lib\net35'.

Id: Koteyka.GlobalCs.Fw35
Version: 1.2.3
Authors: Koteyka
Description: Global types, helpers, extension methods for projects written in C#.
Dependencies: None

Added file 'lib\net35\Koteyka.GlobalCs.Fw35.dll'.

Successfully created package 'PackedCompiledProjects\Koteyka.GlobalCs.Fw35.1.2.3.nupkg'.

Attempting to build symbols package for 'Koteyka.GlobalCs.Fw35.csproj'.
Packing files from 'c:\WorkspacesNet\Koteyka.GlobalCs\Koteyka.GlobalCs\lib\net35'.
src\$(MSBuildProjectDirectory)\**\*.cs
Cannot add part for the specified URI because it is already in the package.
```

**Important note**

I'm really in doubt about the source of this error. It's a strange thing that I can't create NuGet symbol packages for projects that use wildcards. The "main project" (one that .NET Framework 4.5) creates both regular and symbol NuGet packages without any problem. I can't find any other significant difference in these csproj files that could be a source of the error. That's why I have the assumption you've read.

Could you please tell me, what I'm doing wrong and/or how can I solve the problem, leaving wildcards in my csproj files? You can reproduce the bug using the project I've attached to this issue.

Thanks in advance!

p.s. Sorry for my poor English.

**UPD** Software version information.

**Microsoft Visual Studio Ultimate 2012 Version:** 11.0.50727.1 RTMREL
**Microsoft .NET Framework Version:** 4.5.50709
**NuGet Version:** 2.2.31210.9045
**NuGet Package Manager:** 2.2.31210.9045
Comments: Thank you very much for your attention on this issue! Should I expect that NuGet will support wildcards in csproj file in future?

Viewing all articles
Browse latest Browse all 7612

Latest Images

Trending Articles



Latest Images