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

In VS2017.3, .Net Core2 console application with dependency of net45 library have no entry in deps.json and raise an exception 'System.IO.FileNotFoundException occurred' #1621

Closed
dsplaisted opened this issue Oct 2, 2017 · 10 comments
Milestone

Comments

@dsplaisted
Copy link
Member

From @moh-hassan on September 29, 2017 1:23

I have a solution in vs2017.3 RTM with two projects ConsoleAppCore2 and NetStand2Lib.
.Netcore2 console application ('ConsoleAppCore2') reference NetStand2Lib project (NetStand2Lib)

The NetStand2Lib project reference mylib.dll which is .Net Framework 45 (net45).
The compilation is successful and mylib.dll is copied to the bin folder.
When I try to run the application, I get run-time exception error:

System.IO.FileNotFoundException occurred
HResult=0x80070002
Message=Could not load file or assembly 'mylib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.

I inspected the generated dependency file 'ConsoleAppCore2.deps.json' file and find no entry for dependency at all to mylib.dll. Below is part of deps.json :

	  {
	  "runtimeTarget": {
		"name": ".NETCoreApp,Version=v2.0",
		"signature": "78d5ac0bccb1c0063faa39eccad7f2c5c81c635a"
	  },
	  "compilationOptions": {},
	  "targets": {
		".NETCoreApp,Version=v2.0": {
		  "ConsoleAppCore2/1.0.0": {
			"dependencies": {
			  "NetStand2Lib": "1.0.0"
			},
			"runtime": {
			  "ConsoleAppCore2.dll": {}
			}
		  },
                           ..........

My workaround solution:
I explicitly added mylib.dll as a reference in ConsoleAppCore2 project. , I find an entry in the file ConsoleAppCore2.deps.json to mylib.dll and it's working fine.

i reached these issues dotnet/cli/issues/595 , dotnet/sdk/issues/120 but they can't help.
I posted this issue in dotnet/sdk
What i missed to avoid my workaround solution and avoid the reference twice to mylib.dll
Or is this a waiting support feature?

Copied from original issue: NuGet/Home#5955

@dsplaisted
Copy link
Member Author

From @emgarten on September 29, 2017 3:28

Closing in favor of the SDK issue since it looks like this a project issue, not a package issue.

@moh-hassan when copying the same issue between multiple repos be sure to use the full URL of the issues. The referenced NuGet issues here have nothing to do with this problem, but I see that in the SDK issue they do match up with similar SDK issues.

@dsplaisted
Copy link
Member Author

From @moh-hassan on September 29, 2017 22:33

@emgarten, thanks for hint, I modified the issue url.
My issue is similar to this one #4581
Have a look for my reply

@dsplaisted
Copy link
Member Author

It looks like the issue here is a P2P reference to a project that has a direct DLL reference. IE project A has a P2P reference to project B, and project B has a DLL reference to C.dll. The reference to C.dll isn't flowing through to project A, leading to a runtime failure.

@supermartzin
Copy link

I am having exactly the same issue with .NET Standard 2.0 library referenced in .NET Framework 4.7.1 application.

Is there any temporary fix for this besides manually copying all dependencies to main output folder?

@livarcocc
Copy link
Contributor

Is this transitive Reference assemblies? If that's the case, I don't believe we support that.

@livarcocc livarcocc added this to the Discussion milestone Jan 25, 2018
@redcoreit
Copy link

@livarcocc can you explain what does it mean "I don't believe we support that."?!
I have the same issue and I can't see other options to achieve my goal. I have large amount of generated code in assembly C and I don't want to work with it, only using it. Performance of VS is in a different league with this approach!

Any suggestion to get rid of the situation?

@livarcocc
Copy link
Contributor

We don't support transitive reference assemblies. For example:

A depends on B as a Project Reference.
B depends on C as a Reference.

A can't see C, because the reference assemblies are not carried transitively.

Now, we currently have a bug where Reference assemblies are being bin placed but they are not being written to the deps.json file, which prevents us from loading them. @tannergooding is looking into this bug and should have a PR out for it soon targeting release 2.1.300 of the .NET Core SDK.

@redcoreit
Copy link

Yes, that's my problem (last paragraph)! Thank you for clarification!

I'm looking forward to version 2.1.300!

@moh-hassan
Copy link

And me, looking forward to version 2.1.300 of the .NET Core SDK :)

@tannergooding
Copy link
Member

This should be resolved as of #2090

JL03-Yue pushed a commit that referenced this issue Mar 19, 2024
[main] Update dependencies from dotnet/arcade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants