-
Notifications
You must be signed in to change notification settings - Fork 5k
.net Core App 1.1 doesn't resolve file linked .net standard libs #7583
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
Comments
@Gentlehag If you set Microsoft.NETCore.DotNetHostPolicy.SetAppPaths to true in your runtimeconfig.json, then does the application work? |
I'm investigating. |
@Gentlehag - which version of the SDK are you using? I did the following:
I tried with both
and
And they both run fine (prints "Hello World!"). UPDATE: I also opened the |
Looking into this a bit deeper (which I was able to do since you commited the The reason it doesn't show up in this deps.json file is because it is not listed as a library in the project.assets.json file, which NuGet writes. @emgarten @rohit21agrawal - any ideas why this would be the case? My VS 2017 RTM version lists the P2P as a library in the project.assets.json. @Gentlehag - which version of VS are you using? Can you do "Help -> About" and "Copy Info"? |
I made some further tests. it seems to work "sometimes" . You can try to remove the refernce to the service which is currently a project reference and then set the reference to the .net standard assembly. this is the way i can reproduce it now on all machines my Visual studio version is : Microsoft Visual Studio Professional 2017 Installed Version: Professional Visual Basic 2017 00369-60000-00001-AA208 Visual C# 2017 00369-60000-00001-AA208 Visual C++ 2017 00369-60000-00001-AA208 Application Insights Tools for Visual Studio Package 8.6.00209.10 ASP.NET and Web Tools 2017 15.0.30223.0 ASP.NET Web Frameworks and Tools 2017 5.2.50127.0 Azure App Service Tools v3.0.0 15.0.30209.0 Azure Data Lake Node 1.0 Azure Data Lake Tools for Visual Studio 2.2.5000.0 Command Bus, Event Stream and Async Manager Merq Common Azure Tools 1.9 Fabric.DiagnosticEvents 1.0 GitHub.VisualStudio 2.1.1.4 JavaScript Language Service 2.0 JetBrains ReSharper Ultimate 2016.3.2 Build 107.0.20170126.120331 KofePackagePackage Extension 1.0 MenuCommands Extension 1.0 Microsoft Azure Hive Query Language Service 2.2.5000.0 Microsoft Azure Tools 2.9 Microsoft MI-Based Debugger 1.0 Microsoft Visual Studio VC Package 1.0 Mono Debugging for Visual Studio Mono.Debugging.VisualStudio NCrunch NuGet Package Manager 4.0.0 SQL Server Data Tools 15.1.61702.140 ToolWindowHostedEditor 1.0 TypeScript 2.1.5.0 Xamarin 4.3.0.459 (7c3dcf2) Xamarin.Android 7.1.0.13 (72366f7) Xamarin.iOS 10.4.0.33 (d93ae7e) |
Just recognized that it works when i put the dependency ina nuget package. I uipdated the repo with a second console project which uses the nuget package and which is always working Ok Summarized: It failes 100% in my tests when both are true
And it always wroks when:
So shortcut to reproduce the bug: |
@eerhardt Is there a more appropriate repo to move this issue to for the right folks to drive it further? |
At this point, I'd say https://github.com/nuget/home. NuGet isn't writing the correct information into the project.assets.json file. |
Closing the issue in favor of NuGet/Home#4772 |
Based on this it sounds like a direct reference issue:
Using for ConsoleApp1: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="..\Service\bin\Debug\netstandard1.6\Service.dll" />
</ItemGroup>
</Project> I see with dotnet run:
On the project.assets.json differences:
@Gentlehag can you provide more details on why the project.assets.json files checked into the repro have different results than what I see locally when running? It looks like Service.csproj was missing when restore was run. When trying from both VS and dotnet I see an entry for Service.csproj in the output. |
I'm not sure where this offset comes from. But i think thats another issue. The easiest way to reproduce the bug is with a single .net core solution which only has a file reference to an existing .net standard library dll. So for this way:
It is also reproduceable when you fo:
In this case the exception occurs without missing the project. this one has only a single project and a file refrence to the preexisting .net standard library assembly. |
to avoid misconceptions i made a short screencast. https://www.youtube.com/watch?v=08uMd5wSyXc to demonstrate it is only realted to core 1.1 you can see that it fails at first and after changing to core 1.0 its working. |
Ok, this new information makes sense now. Since this is a reference to an assembly on disk, that's why NuGet wasn't writing the information into the project.assets.json file, which is correct. @Gentlehag, the .NET Core SDK v1.0 (Visual Studio 2017 RTM) doesn't support direct references to assemblies on disk. Basically the options that will give you success are either We did enable this scenario for 2.0 though. See dotnet/sdk#120, but those bits have not been released yet. They will be when .NET Core 2.0 comes out later this year. |
Well thats not exactly corret in .net core 1.0 it works. it only doesn't work in 1.1. @eerhardt is that expected ? Also it would be nice that the IDE wouldn't allow a feature that the clr is not supporting :-( |
You are right. @gkhanna79 - is this expected? The 1.1 host has become more restrictive and won't load assemblies that aren't in the
Agreed. This feature is coming in for 2.0, so it may not be worth changing the IDE now. /cc @davkean |
ok. Thx for the detailed informations |
Yes, the host in 1.0.x had a bug that was fixed in 1.1.0 to only honor closure from deps.json. |
same issue here, cannot use a .net standard 1.6 with .net core 1.1. |
Steps to repro using CLI:
My environment |
use |
@WallaceKelly Can you please move your repro steps into an issue in the CLI repo where it is best discussed? |
@gkhanna79 I (mistakenly?) thought it was more of a runtime issue, since it seems to compile fine and fails at runtime. Regardless, I found the duplicate issue at https://github.com/dotnet/cli/issues/5847, which says it will be supported on 2.0. |
Why is this closed? The referencing external dlls worked pretty well since dotnet 1.0.0 to "1.0.0-preview2-1-003177" SDK and now it's broken with released SDK 1.0.1/1.0.2. We are moving from json to csproj format and this bug does not allow to run executables at all. How to workaround it? I tried several ways and no one helps. |
@eerhardt Did we ever close on the referencing assemblies discussion? Is there an issue for it? |
Because there is no more work to do regarding this issue. netcoreapp1.0 had a bug that would load assemblies in the app's directory, even if they weren't listed in the .deps.json file. This bug was fixed with netcoreapp1.1. In the .NET Core SDK 1.0, there wasn't support for straight In .NET Core SDK 2.0 (which hasn't been released yet), we added support for straight To use this, you will need to either:
My recommendation would be to either stay on netcoreapp1.0, or move to .NET Core SDK 2.0 daily builds. |
@eerhardt we used assembly wrapping into project with Then we decided to move to *.csproj and now nor assembly wrapping nor referencing assembly from csproj does not work. I don't know has it done by the some bug resolution or something else, but I think it's quite strange, that functionality which worked with |
What does your .csprojs look like? |
Wrapper project does not contain any source files, only assembly reference. TestAsm.csproj <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="TestAsm.dll" />
</ItemGroup>
</Project> Main project is typical <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
<ProjectReference Include="..\TestAsm\TestAsm.csproj" />
</ItemGroup> When I run If you interested I can create solution on github which shows the reference assembly issue. |
The feature you are using in project.json to use a project.json to wrap a pre-built assembly (https://github.com/ServiceStack/ServiceStack/blob/netcore/src/ServiceStack.Text/project.json#L24-L30) is not supported in But what you are doing in your .csproj is not the equivalent of what was happening in project.json. To do the equivalent in a .csproj, you would need to fake out the build system to tell it that THIS .csproj produces a pre-built assembly. I can imagine 2 ways of doing that:
But I think that would be way too much work. So I would suggest either:
@livarcocc - FYI on the take-back from project.json. |
nuget pack does not work, because current structure is:
When we pack ServiceStack.dll to So when I add This is the simplest scenario, in more complex scenarios packages have more dependencies to other libraries. So adding nuget packages produce a mess which is very difficult (if even impossible) to manage. Making real project from ServiceStack.dll is impossible too, because it's dependent on ServiceStack.Text.dll (and alot of other libraries) and this produce circular reference and even if it were not circular it would have been huge project which must contain all Servicestack solutions together. With wrapper projects or referenced assemblies this schema works without issues. |
@eerhardt do you have any idea why the reference is passed to |
I had a project in .net core 1.0 which is refrencen a standard 1.4 library. this works fine.
No i tried to switch to .net core 1.1 an I get AssemblyNotFoundExceptions.
To isolate the problem I tested the same thing by creating a new project with the released VS2017
Fir this I created a solution with 2 projects. A .net core 1.1 host (console) and a .net standard 1.4 class library.
I changed the standard lib to 1.6
Then I add the reference to the client as project refrence in the core console project.
Then at runtime i get the exception that the assembly of the client is not found. And this at the first place i use a type of the .net standard assembly so my test console looks as trivial as this:
When I switch the host project to .net core 1.0 everything is working fine.
I published a sample here: https://github.com/Gentlehag/coreapp11bug
Is this expected behavior ?
Which .net standard library version should work with .net core 1.1 ?
PS: I also posted here:
http://stackoverflow.com/questions/42677625/net-core-app-1-1-doesnt-resolve-external-net-standard-libs
The text was updated successfully, but these errors were encountered: