-
Notifications
You must be signed in to change notification settings - Fork 252
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
dotnet restore does not capture transitive framework assemblies from project references #4412
Comments
@NTaylorMullen The current design is that With project.json framework assemblies were explicitly defined for NuGet in a special section of the file. With csproj both references to external dlls on disk and framework references are If this were changed and a subset of @srivatsn what would you expect here? |
That's unfortunate then. This used to work in |
@NTaylorMullen fixing this as part of migrate sounds like a better way to handle this. Afterwards the information project.json had as to what was a framework assembly reference that should flow vs a normal reference is gone. |
/cc @livarcocc |
Migration used to do this, but once transitivity was to the SDK we removed this. So, I guess we need to add it back? Is this related to dotnet/sdk#714? |
@NTaylorMullen please, file an issue in the CLI for this. |
As Sri pointed out in the CLI issue. This would bring back problems where we would need to keep the project.json around until migration is fully done. This would be a problem for VS, as they migrate each project separately (including moving artifacts to backup). This is copied over from the CLI issue:
I am not sure why NuGet decided not to honor this in the MSBuild world. But I feel like none of the options above are ideal for the stage we are in the cycle. |
So, after thinking about this, I don't think it is right for migration to handle this and as I stated above we really can't. This is a gap in transitive dependencies that should be handled. In my opinion, NuGet should add these references to the asset.json file and the SDK should find and pass them forward. Now, given the timeline, I understand this not happening, but I don't see how we can handle it in migration either. |
I think this would make it very confusing for the user when some references flowed transitively and others didn't. For example: <Reference Include="MyOwnGACReference" />
<Reference Include="System.Xml.Linq" />
<Reference Include="external.dll" /> The only framework assembly here is If we do try to go the route of flowing these then I think this issue should be tracked on the SDK side also, Restore would need something aware of the framework to provide the list of framework assemblies to put into the project.assets.json file before this could happen. |
The lack of dependency information in .NET Core assemblies is a visible gap compared to .NET Framework assemblies. Using the same code to examine the dependencies when running Core or desktop applications will fail for Core and work for desktop. Attempting to avoid this gap during migration does not actually solve the problem, especially for dynamic load scenarios. As things stand, every MVC web site must have <Target Name="CopyDepsFiles" AfterTargets="Build" Condition="'$(TargetFramework)'!=''">
<ItemGroup>
<DepsFilePaths Include="$([System.IO.Path]::ChangeExtension('%(_ResolvedProjectReferencePaths.FullPath)', '.deps.json'))" />
</ItemGroup>
<Copy SourceFiles="%(DepsFilePaths.FullPath)" DestinationFolder="$(OutputPath)" Condition="Exists('%(DepsFilePaths.FullPath)')" />
</Target> |
Sorry if this is the wrong place for this, but I have not seen any recommendations/suggested workarounds on how to handle this problem for building nuget packages that require framework assemblies in vs2017. So, do we continue to manually add the framework assembly references that the nuget package requires to the consuming project or build the nuget package using a nuspec file in order to make use of the frameworkAssemblies tag/property? |
That's really a nasty surprise, and a very annoying breaking change! 👎 |
@forrestab this sounds difficult, would you open a new issue to track adding framework assemblies during pack? This issue is specifically for the restore/consuming side of framework assemblies. |
Can we get an ETA on this or reprioritize it? This keeps coming up for our users when they try to integration test MVC sites or develop a multi-project MVC site. Example here: aspnet/Razor#1212 We've had many bugs like this 😞 Our best mitigation right now is to spread the hack that's described here. |
Is there a fix planned for this bug on the roadmap? Just as stated before, this problem seems to be the source for several other bugs. |
@giggio can you share what this is? Is there a reason you are fixing it in deps instead of referencing the framework assemblies from the projects directly? Feedback on why this issue is important would help the NuGet team prioritize this. |
@emgarten In my case I have an integration test, referencing an aspnet core project (a) that references another aspnet core project (b). My views are in project (b) and unless I use the .deps hack I get an error on the compilation of any of the views. The views are using an embedded file system. |
@giggio what exactly do you change in the .deps file? I'm not clear on what is missing and why in your scenario. |
I don't change anything, I just need to copy the deps file, as shown here: #4412 (comment) |
Guys, any update on this ? I have a .NET FX csproj that references .NET Standard csproj. That .NET Standard csproj packagereferences a package. How can this be generated so that transitive project->package references are properly collected, without resorting to manually redeclaring all nested package references in the top level project? That defeats the sole purpose of package reference. |
From @NTaylorMullen on January 19, 2017 20:24
Trying to utilize a transitive project references framework assembly results in build errors. This looks to be the result of
dotnet restore
not capturing project references framework assemblies (doesn't exist in assets.json).Note: This used to work in project.json land (built the repro in project.json then migrated).
See the simple repro here:
TransitiveProjectFrameworkRefs.zip
Go into ConsoleApp12 and
dotnet restore; dotnet build
Copied from original issue: dotnet/sdk#691
The text was updated successfully, but these errors were encountered: