-
Notifications
You must be signed in to change notification settings - Fork 258
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
Framework assemblies are no longer added to .nuspec when using the new .csproj project system #4853
Comments
@dsplaisted Can |
It will be able to in the 2.0 tools. |
@dsplaisted will there be a way to distinguish what References come from the framework and what come from a DLL on disk? Is there a design doc for this so we can adapt pack accordingly? |
Here's the PR where this was added to the SDK: dotnet/sdk#876 It turns out we mentioned that nuget pack would need to handle this but never filed an issue. The logic to figure out where the references actually come from is very complicated and involves the ResolveAssemblyReferences task. I doubt there is a current spec for it. It might be OK to just see whether the ItemSpec has a .dll or .exe extension, and if so assume it's a file reference, otherwise assume it's a framework reference. Also, .NET Core and .NET Standard projects wouldn't support framework references anyway. @rainersigwald, @nguerrera, or @eerhardt may be able to provide more feedback. |
This is a pretty big blocker to find out about at the end of a port. Is there a workaround? I'm porting major libraries here (Dapper, MiniProfiler, StackExchange.Redis, etc.) and this is a big step backwards for the consumer, having to reference framework libraries manually that just worked on the old system. From a user point of view, they're better off with me not moving to the VS 2017 project system - what can we do so this isn't the case? |
Due to the way VS test works (by injecting an executable entry point), the performance tests needed to be factored out. I also organized all of our existing tests better along the way. Actual code changes to Dapper itself are very minor, only formatting and documentation fixes (which we need many more of). The build.ps1 script is upated to work, but note that <frameworkAssemblies> is not working in .nuspec inside the packages in the new .csproj system. I consider this to be a blocker. Issue is here: NuGet/Home#4853
One work around would be to continue to use a nuspec, I think. |
@dsplaisted that's a pretty big hammer of a workaround. |
A better workaround in my opinion would be to use the GenerateNuspec task to get a nuspec without the framework assemblies in your obj folder, then write a custom task that takes in this nuspec and adds the framework assemblies (can use any xml reader writer for this), and then pack the resulting nuspec. I know its not the most convenient thing but its not terribly hard either. I can come up with a small example of how to do this if you think this might help. Let me know. |
Are we expecting every library author that writes a package that supports .NET full framework (the vast majority of packages) to do this in under to use the new tooling for the next 3 minor releases? Am I the only one that sees this as a large blocker that really needs to be addressed in NuGet 4.1 (or hopefully, sooner)? Let me be as blunt as possible: We aren't porting our projects to the new |
Cc: @rrelyea for your urgent triaging attention |
Is there any hope of getting this fixed soon? We're ready to merge in Remember to port to Please up the priority on this, it needs a fix very soon. |
@NickCraver to get you a workaround as fast as we can, can you help me understand how are you packing projects? msbuild or dotnet or VS? |
@rohit21agrawal I have steps and an easy repro for you, an example library is MiniProfiler (current commit link). You only need to run this: .\build.ps1 -VersionSuffix "alpha1234" You can see everything in the simple build script, but here's the relevant bits: dotnet msbuild "/t:Restore;Pack" "/p:Configuration=Release" "/p:VersionSuffix=$VersionSuffix" "/p:PackageOutputPath=$packageOutputFolder" "/p:CI=true" Note that I have to currently use cc @onovotny who also noticed this break |
The packaging in this case is done by the The build already walks all the framework targets to get it's output files per target framework. The same way it could get the required |
I've dug around a bit more, and there is an I added this task to the .csproj
Those were passed in to the PackTask: But no changes to the nuspec. The |
Context: I have changes I want to deploy in multiple fairly high usage libs: dapper, protobuf-net, stackexchange.redis, etc (including multiple MS PRs that I'm sure they'd love to see deployed). Being "bleeding edge, feel the pain", I've updated from csproj to project.json back to csproj. And the thing that makes me not want to push to nuget: this glitch, because it will actively hurt my users. |
@rohit21agrawal @rrelyea Is there any update here? This is a HUGE pain for us. We'll soon have to throw away the ports of projects we've done or face severe merge headaches, and we don't know which route is worse. We have an entire pipeline of new tooling in play that works from start to finish (even if it's a workaround in place) up until the final packaging. We can't release the libraries generated by the tooling to our users; that'd be actively harmful to the community. Why isn't this a higher priority? There's no way this can linger for months, unless we simply don't care about any library authors moving to VS 2017 until the Update 3 timeframe. This is the worst kind of bug, one developers very likely don't even know they're causing. I highly doubt we're the only ones affected - there's just no way, and I've already heard from other authors. I think we're just some of the few who noticed. Please, please treat this as higher priority than months away. It is so insanely frustrating to be blocked by only this issue on so many large projects. We'd take any fix here, including any incredibly hacky workaround. |
@NickCraver I am working on this issue, I will update this thread very soon. |
Personally, I opted for the "custom .nuspec approach". It's not ideal, but it works:
|
as of now it ships as part of both VS and .NET Core. |
@rohit21agrawal I've tried packing with Visual Studio, and also using The file version of |
@bording that version definitely has the fix. can you provide me a sample of the project that repros this for you? |
@rohit21agrawal I've been seeing this while working on https://github.com/Particular/NServiceBus, and the develop branch now has netcoreapp2.0 targets. As an example, this project file has framework assembly references that are not included by default in the new project system, but the package produced does not reference them. |
I just tried packing the project file you provided with the version of msbuild that shipped with 15.3 Preview 3 and i got the following assembly references in my output nuspec: I did have to remove netcoreapp2.0 as target framework because restore wasn't able to resolve some package required for that particular TFM.
|
@rohit21agrawal I'm definitely not seeing that when I build it. What package could you not resolve for netcoreapp2.0? They should all be publicly available. |
When I pack that project here is the nuspec that gets generated in the obj folder:
|
@bording silly question, but how are you invoking your build when you're trying this? Are you sure you're using the msbuild from the VS Preview directory and not the main VS 2017 stable directory? (just verifying) :) |
@onovotny I'm running it from a VM that has only ever had the preview VS installed, so there isn't another MSBuild to conflict. To double check, here's the output from
|
@rohit21agrawal I also just tried removing the netcoreapp2.0 target from the AcceptanceTesting project to see if that was somehow causing the problem, but it just produces the following:
|
can you do a diag build+pack and attach the log file? |
@rohit21agrawal What would be the specific command you'd like me to invoke? Just enable diagnostics level logging? |
Msbuild /t:pack /v:diag |
@rohit21agrawal Here you go: |
This is what i see in the log file. So the msbuild you are using is resolving the dotnet core sdk to 2.0.0-preview1-005977 which does not have the fix. |
@rohit21agrawal Is it supposed to do that? Is there a way for me to prevent that from happening? |
@bording I actually don't know that for sure. Tagging @nguerrera since he might be the best person to answer this. |
but for now, you can always install the latest CLI from https://github.com/dotnet/cli/tree/release/2.0.0-preview2 and that should fix your problem. |
I had been wanting to wait for the official preview 2 bits before installing them, but if that's the only way to work around the issue, I guess I should give them a try now. |
The way to stop it is to use a global.json and pin the SDK version to 1.0.4. That's the one VS 2017 ships "in box". |
@onovotny Will that still work if I'm actually targeting netcoreapp2.0, though? |
@bording nope. If you need netcoreapp2.0, then you'll need the latest SDK from the preview2 branch then. FWIW, I have that working on AppVeyor w/o issues: https://github.com/paulcbetts/refit/blob/master/appveyor.yml#L7-L9 |
Sounds like I'll be grabbing some preview2 bits then! It does seem odd to me that MSBuild would ship with a version of the PackTask assembly that won't actually be used though, even when targeting just net452. |
Another workaround would be to use the <Project>
<PropertyGroup>
<NuGetBuildTasksPackTargets>junk-value-to-avoid-conflicts</NuGetBuildTasksPackTargets>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<!-- All your project's other content here -->
<ItemGroup>
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="4.3.0-preview3-4168" PrivateAssets="All" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project> VS' MSBuild now carries an SDK resolver that uses the installed CLI. AFAIK mono's msbuild will do the same. |
Due to the way VS test works (by injecting an executable entry point), the performance tests needed to be factored out. I also organized all of our existing tests better along the way. Actual code changes to Dapper itself are very minor, only formatting and documentation fixes (which we need many more of). The build.ps1 script is upated to work, but note that <frameworkAssemblies> is not working in .nuspec inside the packages in the new .csproj system. I consider this to be a blocker. Issue is here: NuGet/Home#4853
Due to the way VS test works (by injecting an executable entry point), the performance tests needed to be factored out. I also organized all of our existing tests better along the way. Actual code changes to Dapper itself are very minor, only formatting and documentation fixes (which we need many more of). The build.ps1 script is upated to work, but note that <frameworkAssemblies> is not working in .nuspec inside the packages in the new .csproj system. I consider this to be a blocker. Issue is here: NuGet/Home#4853
Moved from #4412 (comment):
In the marvelous world of
project.json
, specifying aframeworkAssemblies
node was enough to tell NuGet to add the corresponding entries in the.nuspec
file:With .csproj, this is no longer true when using
Reference
:This breaking change has obviously important implications, as framework assemblies are no longer brought transitively, which means that the final user of the package has to reference the framework assemblies in his own app.
The text was updated successfully, but these errors were encountered: