Project-system: Error when referencing a .NET Core Class project with WPF project in solution

Created on 30 Jun 2016  路  16Comments  路  Source: dotnet/project-system

I get the following error... "A reference to "xxx" could not be added. An assembly must have a 'dll' or 'exe' extension in order to be referenced."

The .NET Core Class project can be referenced and used when referencing by browsing/selecting DLL. However, this approach doesn't allow stepping into code when calling from the WPF project in solution.

I'm trying this with VS 2015 Update 3 and .NET Core v1 Class project template.

Tracking

Most helpful comment

Still no solution as of October 2016! :(

Please make it a priority....

All 16 comments

Thanks for the issue, this is a known issue and will be fixed as part of this: https://github.com/dotnet/roslyn-project-system/issues/131.

Great. Should I close this issue then?

Let's use this issue to verify that this scenario works after the language service integration is complete.

@srivatsn Still doesn't work in 1.0 RC

Still no solution as of October 2016! :(

Please make it a priority....

@tx8821 I believe this will be fixed in 1.0 RC release.

Folks, we've not yet had a public release of the new MSBuild-based .NET Core tooling. This issue will be addressed by the first public release.

This works in RC.

@srivatsn I'm still getting errors with this, but not exactly as from original issue. I can move to another issue if needed.

1.) Create new WPF app.
2.) Right click solution and add new .NET Core Library project.
3.) Right click WPF project and reference the .NET Core project.
4.) The .NET Core project is added under references, but there is a yellow triangle next to it. I also get the following in the Error List window:

Severity Code Description Project File Line Suppression State
Warning The project 'ClassLibrary1' cannot be referenced. The referenced project is targeted to a different framework family (.NETStandard) WpfApp2

5.) When I tried to build the WPF app, I also get the following warning:

Severity Code Description Project File Line Suppression State
Warning Failed to resolve all project references. The package restore result for 'WpfApp2\WpfApp2.csproj' or a dependant project may be incomplete. 0

Am I missing a step?

I see the yellow triangle as well and that's tracked by https://github.com/dotnet/sdk/issues/266 . However that warning is benign (an incorrect assumption in the native project system that's being fixed) and I'm able to build successfully and I get intellisense etc.. Can you look at your output window to see why the package restore is failing?

It appears I can build successfully, but no intellisense. Only thing I see in Output window...

Failed to resolve all project references. The package restore result for 'WpfApp2\WpfApp2.csproj' or a dependant project may be incomplete.
Restoring NuGet packages...

Restore inside VS asks the project system for the reference, because it's unresolved NuGet will see a bad reference.

You'll also not get intellisense side in the WPF app.

I see intellisense from the WPF project as well.
image

After some experimenting, it seems to happen only after a closing\reopening after building the solution. Reopening the issue to make sure that the fix for https://github.com/dotnet/sdk/issues/266 fixes the flakiness.

@srivatsn After restarting VS, the intellisense/colorization appears to work. They stopped and couldn't recognize the library class when I tried rebuilding the WPF project.

I also linked this other issue I was seeing until you restart VS. Not sure if it is related.
https://github.com/dotnet/roslyn/issues/15388#issuecomment-262196764

Thanks for looking into the issue.

@davkean @srivatsn I just retried this again after updating to VS15RC2 and appears to work as expected. Also... the performance seems to be MUCH better in this version.

I went ahead and closed issue. Reopen if you need it for tracking something else.

Thanks 馃憤 馃憤

Great to hear!

Was this page helpful?
0 / 5 - 0 ratings