You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DependencyContext.Load not loading compile library assemblies #8805
context.CompileLibraries having Assemblies property filled with assembly paths.
This used to work in previous versions.
Actual behavior
Assemblies always empty.
Environment data
.NET Command Line Tools (2.0.0)
Product Information:
Version: 2.0.0
Commit SHA-1 hash: cdcd1928c9
Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.0\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
Does my project needs to have some kind of configuration for this to work?
Or it has to be loaded in a different way to get compiled assembly paths.
@eerhardt any idea when/why this might have changed? @Kurira, it would be helpful if you could indicate when this worked before. I believe the DependencyContext is constructed using the deps.json file for your app, as such I am not sure how it would find absolute paths to assemblies. I haven't dealt much with that code, so it is completely possible it is looking at actual assemblies, but I will let @eerhardt say for sure.
@livarcocc it used to work on v1.x~, and even now I see mvc core doing something similar to this and it works there. I'm not sure if any prep work needs to be done here, for this to work.
Yes, that helped, thank you @eerhardt! I somehow thought I tried that already.
Will do some testing with custom tools and will close it if everything is fine.
Activity
livarcocc commentedon Nov 11, 2017
@eerhardt any idea when/why this might have changed? @Kurira, it would be helpful if you could indicate when this worked before. I believe the DependencyContext is constructed using the deps.json file for your app, as such I am not sure how it would find absolute paths to assemblies. I haven't dealt much with that code, so it is completely possible it is looking at actual assemblies, but I will let @eerhardt say for sure.
Kurira commentedon Nov 11, 2017
@livarcocc it used to work on
v1.x~, and even now I see mvc core doing something similar to this and it works there. I'm not sure if any prep work needs to be done here, for this to work.eerhardt commentedon Nov 11, 2017
You need to set a property in your .csproj for the compile assemblies to work.
Under a PropertyGroup element in your csproj, add a PreserveCompilationContext element and set its value to “true”.
There was a similar property in the old project.json file.
Kurira commentedon Nov 11, 2017
Yes, that helped, thank you @eerhardt! I somehow thought I tried that already.
Will do some testing with custom tools and will close it if everything is fine.
livarcocc commentedon Nov 11, 2017
Let us know how it goes. I frequently forget about
PreserveCompilationContext.Kurira commentedon Nov 18, 2017
Thanks, seems like it's working even without
PreserveCompilationContextif you are using that code in a tool.