-
Notifications
You must be signed in to change notification settings - Fork 258
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
nuget.exe pack doesn't work for legacy csproj referencing net core projects with -IncludeReferencedProjects flag #4054
Comments
@gulbanana our latest builds have a new command line param for the pack command : -MSBuildPath Specifies the path of MSBuild to be used with this command. This command will take precedence over MSbuildVersion, nuget will always pick MSbuild from this specified path. you can also use -MSBuildVersion 15 to make it pick the msbuild that comes with VS2017 RC you can get the latest nuget.exe from the nuget package available at : https://dotnet.myget.org/F/nuget-build/api/v2/package/NuGet.CommandLine |
Great, I'll try that out |
I was able to access the correct version of nuget using |
we've yet to public 4.0rc2 nuget.exe -- which has an additional fix that shouldn't need the msbuild path to be passed in. running "dotnet nuget pack" may be running the same code path. |
I'm now using nuget.exe 4.0.0.2140 from the commandline package, but it still doesn't work.
The error about bin\Debug\The.Model\bin\Debug\ makes me wonder whether this is a problem discovering the path of The.Model, a .NET Core project. The reference to it from The.Model.Editor looks like this:
And here is The.Model.csproj itself:
|
If I remove -IncludeReferencedProjects, I get this error instead:
|
@gulbanana - you should use nuget.exe for non NetCore projects and dotnet.exe for netcore projects |
That is what I am doing, but nuget.exe does not work to pack a noncore project which depends on a core/netstandard project. |
@gulbanana - I ll look into this, I would really appreciate if you attached a small repro project that highlights the issue |
Ok, I will be able to supply a repro tomorrow. |
I've actually found at least three separate issues, so this is going to be spread across a couple of posts.. netfxlib depends on netstdlib. netstdlib packs correctly:
netfxlib pack fails to IncludeReferencedProjects:
And if -IncludeReferencedProperties is not specified, nuget 4.0 emits a different error:
|
The netstdlib2 packs correctly:
netfxlib2 fails to pack:
|
@gulbanana while i can repro the cases using your branch (both master and multitarget) for nuget pack -includereferencedprojects case, the scenario for vanila nuget pack (without includereferencedprojects flag) works fine on my machine. i'd try repairing your installation of visual studio to make sure all the DLLs are in the right place. |
Important to do, but won't be done by VS2017. Should consider immediately after. |
:( This is going to block vs2017 for us, then. Will there really be no way to create nupkgs depending on netstandard projects before vs2018/19? |
@gulbanana we will ship an update to NuGet much before the next version of NuGet. You won't have to wait too long |
OK, that's a relief. |
Getting the same error using NuGet 4.4 on VSTS build. 2017-10-25T00:51:34.3884127Z ##[section]Starting: NuGet pack |
Also got this error.
Ugly workaround:
|
@acinep how did you solve this? I'm running against the exact same issue here... |
Not related to a dotnetcore project, but we had issues similar to some of those described above trying to pack a project (.csproj) that referenced other projects with -IncludeReferencedProjects where there were nuget packages referenced anywhere in the chain of referenced projects. We got the error A little bit of experimentation revealed that during nuget pack, the nuget packages referenced in packages.config files for the various projects in the chain were being searched for local/relative to the location of either the project being referenced or the packages.config for that project (same directory), instead of the directory where we've installed all of the nuget packages. A hacky workaround that we put in place in our msbuild .proj file was to execute a task before the nuget pack Exec task to create symbolic links creating a .\packages symlink in each of the project directories to simulate each of them having a packages subdirectory, each of which just pointed to \Solution\packages. <ItemGroup>
<ProjectDir Include="." />
<ProjectDir Include="..\OtherProjectDir" />
<ProjectDir Include="..\YetAnotherProjectDirReferencedByTheProjectInProjectDir" />
...
</ItemGroup>
<!-- for each one, make the symbolic link -->
<Exec
Command="mklink /D %(ProjectDir.FullPath)\packages ..\Solution\packages"
IgnoreExitCode="true"
/>
<!-- Run the nuget pack command -->
<Exec
Command="Solution\.nuget\nuget.exe pack 'ProjectDir\Project.csproj' -IncludeReferencedProjects -OutputDirectory $(Configuration)\Nupkg -properties Configuration=$(Configuration);Author=MyCompany;Description=MyCompany"
WorkingDirectory="..\"
/>
<!-- remove the symbolic links we created previous to running the pack command -->
<Exec
Command="rmdir %(ProjectDir.FullPath)\packages"
IgnoreExitCode="true"
/> |
Hi @gulbanana, I'm facing the same issue. I have a .NET standard 2.0 project and a .NET 4.61 which depends on the first.
NuGet Version: 5.0.2.5988 Do you have any recommended workaround to have this working? |
Still a problem in latest version (as of today) 5.5.0 (preview) https://www.nuget.org/downloads Is there a workaround that packs a *.csproj project file, and includes references to other packages from the referenced projects? |
Any update on this? I am facing same issue when I'm trying to pack non-sdk project that references netstandard2.0. |
I am also experiencing this issue :( |
Details about Problem
NuGet product used: nuget.exe
NuGet version: 3.5.0.1938
dotnet.exe --version: 1.0.0-preview3-004056
VS version: VS2017 RC
OS version: Windows 10
Detailed repro steps so we can see the same problem
The idea is to build two nukpgs, one depending on the other.
Create a .NET Core csproj using new features such as <Compile Update=""/>
Create a non-.NET Core csproj referencing the .NET Core csproj
Reference the Core project from the nonCore project.
dotnet pack
the Core project - this succeeds.dotnet pack cannot be used for the nonCore project, so run
nuget pack -IncludeReferencedProjects
- this fails.The failure is due to nuget.exe's attempt to build a MinToolsVersion=15.0 project with msbuild 14. However, there doesn't seem to be any way to get it to use the copy of msbuild 15 which VS2017rc has installed.
Logs
The text was updated successfully, but these errors were encountered: