Skip to content
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

WPF with PackageReference and referencing .NET Core project produces NuGet error on build #4652

Closed
AArnott opened this issue Feb 19, 2017 · 8 comments
Assignees
Labels
Resolution:Duplicate This issue appears to be a Duplicate of another issue Type:Bug
Milestone

Comments

@AArnott
Copy link
Contributor

AArnott commented Feb 19, 2017

WPF stopped building reliably after I added my first PackageReference to it.

git clone https://github.com/AArnott/MoneyMan.git
cd MoneyMan
git checkout bugrepro/nuget/4652
cd src
msbuild /t:restore,build

Expected

Successful build. I've seen this occasionally on this source version, suggesting that this is a non-deterministic failure.

Actual

C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(197,5): error : The project.json is referencing the project 'C:\git\MoneyMan\obj\Nerdbank.MoneyManagement\Nerdbank.MoneyManagement.csproj', but an output path was not specified on an item in the ProjectReferencesCreatingPackages property. [C:\git\MoneyMan\src\MoneyMan.WPF\MoneyMan.WPF.csproj]

Also as seen on Appveyor

Repro machine has: d15rel 26217.2

@emgarten
Copy link
Member

This issue is tracked in #4532

@AArnott would you try the workaround listed in #4532 and see if it works for you?

@AArnott
Copy link
Contributor Author

AArnott commented Feb 19, 2017

Thanks for the tip, @emgarten. The workaround appears to be incomplete. Although it avoids the error message I report above, it is replaced by several new ones from the WPF temporary project, which evidently doesn't contain the resolved package references that the original WPF project does:

ViewModels\AccountsPanelViewModel.cs(13,11): error CS0246: The type or namespace name 'PCLCommandBase' could not be found (are you missing a using directive or an assembly reference?) [C:\git\MoneyMan\src\MoneyMan.WPF\rkqstjls.tmp_proj]
ViewModels\MainPageViewModel.cs(11,11): error CS0246: The type or namespace name 'PCLCommandBase' could not be found (are you missing a using directive or an assembly reference?)
[C:\git\MoneyMan\src\MoneyMan.WPF\rkqstjls.tmp_proj]
ViewModels\AccountsPanelViewModel.cs(15,43): error CS0246: The type or namespace name 'BindableBase' could not be found (are you missing a using directive or an assembly reference?) [C:\git\MoneyMan\src\MoneyMan.WPF\rkqstjls.tmp_proj]
ViewModels\MainPageViewModel.cs(13,38): error CS0246: The type or namespace name 'BindableBase' could not be found (are you missing a using directive or an assembly reference?) [C:\git\MoneyMan\src\MoneyMan.WPF\rkqstjls.tmp_proj]

These errors are consistent with what I would expect if this PackageReference were missing from the original WPF project:

    <PackageReference Include="PCLCommandBase" Version="0.3.5" />

Of course, it is there, but the tmp_proj probably isn't resolving it.

@mishra14 mishra14 added this to the 4.0 RTM milestone Feb 21, 2017
@zhili1208 zhili1208 modified the milestones: 4.0.1, 4.0 RTM Feb 21, 2017
@rrelyea
Copy link
Contributor

rrelyea commented Feb 28, 2017

Dupe of #4532 according to @zhili1208

@rrelyea rrelyea closed this as completed Feb 28, 2017
@rrelyea rrelyea added the Resolution:Duplicate This issue appears to be a Duplicate of another issue label Feb 28, 2017
@rrelyea
Copy link
Contributor

rrelyea commented Aug 16, 2017

@AArnott - can you confirm that this is fixed nowadays? the duplicate bug was fixed in 4.1.

@AArnott
Copy link
Contributor Author

AArnott commented Aug 17, 2017

@rrelyea Happy to test. How do I use 4.1? What vehicle does it ship in?

@zhili1208
Copy link
Contributor

just use VS 2017 15.3 to restore and build

@AArnott
Copy link
Contributor Author

AArnott commented Aug 18, 2017

Yes, it appears to be fixed in 15.3.0. Thanks.

clairernovotny pushed a commit to novotnyllc/MSBuildSdkExtras that referenced this issue May 14, 2018
* Add latest WPF/NuGet workaround

See NuGet/Home#5894 (comment) for context.

* Add %TEMP%\packages to NuGet.config

This ensures that the local dev packages automatically
copied into that directory by MSBuild.Sdk.Extras can be
used by sample and test projects.

* Rewrite WpfApplication sample to consume SDK

* Add and use a NuGet package in the WPF sample

This makes failure to pick up the NuGet packages
an easy-to-detect compile error. I used PCLCommandBase
because that was used in
NuGet/Home#4652 (comment)

Furthermore, note that I did not retarget the sample project
to net472, yet it still works. net472 must be *installed* on
the build machine for this change to succeed; it need not be
*targeted*.

* Move WpfAppUsingSdk into tests directory per request

* Remove local key from top-level NuGet.config

* Move project into correct solution

* Move WPF NuGet props import

Also updated a few comments while I was at it.
@HEskandari
Copy link

There is still an issue with PackageReference that contains source files (imported with PrivateAssets="All"). The source files are not picked up at compile time. This is specific to Microsoft.NET.Sdk.WindowsDesktop SDK projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution:Duplicate This issue appears to be a Duplicate of another issue Type:Bug
Projects
None yet
Development

No branches or pull requests

6 participants