-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dotnet pack project with project reference - FileNotFoundException #4059
Comments
Running with
|
@aL3891 what version of dotnet.exe are you using? |
|
@aL3891 i tried this with the latest dotnet.exe version and latest SDK version. This doesn't repro. Could you give it a try please? Latest NET SDK : https://dotnet.myget.org/feed/dotnet-core/package/nuget/Microsoft.NET.Sdk |
I got a login prompt when I tried go to that myget, but i'm not sure what to log in as. (its odd because im pretty sure i've been able to get at those packages in the past) Also, how do you set the sdk version now that the csproj has a sdk attribute? just add it as a regular nuget reference? I had the strangest when i repo:d this on another machine btw, it sometimes did work, but then the project reference was not included in the actual nuget, then i reran it, and i got the error in OP, |
@aL3891 you can just remove the SDK attribute, and add a package reference to the latest SDK version. classlibrary2.dll will not end up in the nuget package - that is expected behavior. You will have a package reference to classlibrary2 in the nuspec generated in your nupkg. |
if that is the design, there's another bug because the when I do get the error, dotnet pack is trying to add classlibrary2 to the package.. It also seems like a little odd to force each assembly to be its own package.. my base library is not useful on its own, having to publish that as a separate package feels really strange |
adding the sdk nuget gave me the following when building:
my project file looks like this:
|
Once the next RC update goes public, would be great to continue to see if this issue is still a problem or not. |
np! |
We should be able to give you some bits to play with in a week |
@aL3891 would you download the latest CLI+SDK from https://dotnetcli.blob.core.windows.net/dotnet/Sdk/rel-1.0.0/dotnet-dev-win-x64.latest.zip and let us know if your issue still repros? |
Hi, sorry for the delay,
I tried renaming the files in both projects but I still get the same error, I also tied setting the file name explicitly instead of using a glob |
Here are my project files, each project just contain a single empty class
|
The failing tasks in detail:
|
I also get this error when building the second class library by itself so I don't think this has to do with references |
Actually this guy seems to be the cause
Should I open a different issue on sdk maybe? (or cli or msbuild perhaps) |
Got it working by removing the Compile tag, As for the pack, it does seem to work now, there are no warnings or errors and ClassLibrary2 does not get added to the package but is added as a dependency in the nuspec file witch is by design if I understand correctly? It would be nice to tell pack to include project references in the package though :) perhaps there is another way to do that |
@aL3891 we plan to add the capability in 4.0.1 version of nuget. As of now, the best way to do that would be to use a nuspec file - you can use the one generated in the obj folder, and build up on that. If pack works reasonably for you, could you close this bug? |
Allright, cool :) |
I could really use this behavior. This is what I'm doing: <ItemGroup>
<ProjectReference Include="..\Foo.native\Foo.native.vcxproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup Label="Package">
<None Include="..\Foo.native\bin\$(Configuration)\Foo.native.dll" Pack="True" PackagePath="runtimes\win\native" />
<None Include="..\Foo.native\runtime.json" Pack="True" PackagePath="" />
</ItemGroup>
<dependency id="Foo.native" version="1.0.0" exclude="Build,Analyzers" /> which is totally wrong. There needs to be some way to prevent a particular |
@jnm2 add |
@rohit21agrawal Thanks! Where did you find that? It did not seem to work though :-( <ItemGroup>
<ProjectReference Include="..\Foo.native\Foo.native.vcxproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
</ItemGroup> does not seem to have any effect on the nuspec. |
@jnm2 did you restore after making the suggested change? |
@rohit21agrawal No, that did the trick! You rock! Wish this stuff was documented somewhere on MSDN. |
Now, it would be satisfying to get rid of that empty |
@jnm2 glad to help! :) i'll see if i can get it documented. though, in general, this is what we are trying our best to achieve - ProjectReference = PackageReference . Anything that can be be added to a PackageReference in general can also be added to a ProjectReference. |
@jnm2 we don't have that, but maybe in the future we can add a -SuppressDependencies switch to make this happen. Feel free to open an issue :) |
Repro:
in Vs2017 RC (1.0.0-alpha-20161104-2 .net core sdk),
Create a .net standard class library, A
Create another .net standard class library, B
Add project reference to B from A
dotnet restore, build and pack project A
Expected:
a nupkg
Actual:
pack fails with a file not found exception, an incorrect output file somehow gets added as an input.
(also pack target gets imported twice)
The text was updated successfully, but these errors were encountered: