Closed rainersigwald closed 6 years ago
See #2068 for info about problem with 2.1.102 SDK
I'm having this problem but do not have ReSharper enabled (it is installed but suspended).
@scottfavre I found that suspending wasn't enough; I had to disable it through Tools -> Extensions and Updates.
@hughbiquitous You are right, disabling ReSharper is the solution. I have an asp .netcore 2.0 project that used to publish fine. Today I only updated some minor string in my project. It builds and runs fine but when trying to publish it to azure I got:
"Assets file 'C:\xxx\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v2.0'. Ensure that restore has run and that you have included 'netcoreapp2.0' in the TargetFrameworks for your project."
After googling for hours and only after disabling Resharper like hughbiquitous suggested I could finally publish again.
If I remember well I could publish in the past with ReSharper enabled and I did not update ReSharper that I know off. The only thing I did was updating Visual Studio to version 15.6.3.
This solution worked for me, is just adding an s in all
https://stackoverflow.com/a/42855070/819153
how is this related to that?
This issue should be fixed in the 15.6.4 update that was published this morning.
15.6.4 fixed it for me, thanks @Pilchie
@Pilchie I can also confirm that 15.6.4 published the project without errors. It seems that the new dotenet sdk 2.1.103 installwd with the update solved the problem.
The problem is also fixed in ReSharper 2017.3.5, everything works with all combinations of Visual Studio and .NET Core SDK. You can find more technical details in the official blog post: https://blog.jetbrains.com/dotnet/2018/03/23/build-failures-visual-studio-15-6-3-resharper-ultimate-2017-3-5-rescue/
Everything has been fixed on this version: vs15.6.4
----------MS ----------- Release Date: March 22, 2018 - Visual Studio 2017 version 15.6.4 Issues Fixed in this Release These are the customer-reported issues addressed in this release:
The solution from @dhieyson works for me!
For me, recreating a .sln fixed the problem.
My solution was:
Change publish profile, this tag in particular:
<TargetFramework>netcoreapp2.0</TargetFramework>
From 1.0 to 2.0.
For me, opening the 'Publish' Page, then open the 'Configure' dialog, then resaved. It probably just sorted the tags
The solution from @tunechr fixed my issue.
Hmm, well, I don't have a C:\Program Files\dotnet\sdk\2.1.102
, so I don't know. Even after invoking the nuget.exe
process with restore
options, successfully I might add, the assets file lands where expected, I STILL get the error.
Also, to be clear, I do use R#
, but I do not have it enabled for build and run features.
So... I wanted to follow up. I ended up pulling my C:\Program Files\dotnet\sdk
folders aside, both 2.1.200
and 2.1.201
, and the programmatic invocation succeeded. From there I should be able to verify before and after states that I expect with my custom MSBuild tasks.
Either update obj/project.assets.json to reference new framework or delete profile and re-create the profile. Assumptions: -Upgraded project from netcore2.0 to 2.1 -The error encountered when you try to publish using an existing profile.
I was getting a similar error after updating my projects frameworks. I noticed in my publish profile file(Properties/PublishProfiles/*.pubxml) that the TargetFramework hadn't been updated to reflect the new framework. Changing manually in here or simply running through the configure option on my publish tab resolved the issue for me.
@zeroish updating 'Properties/PublishProfiles/*.pubxml' worked for me. I was having the issue on windows, without resharper, VS 2017 15.7.4
@Altiss solutions worked for me!
I got this very same error on project.assets.json when I had converted a .Net 4.5 Class Library project to target multiple .Net Frameworks by manually updating the csproj file. After trying out almost all the solutions listed in this page, the fix that worked for me was to remove the below line from csproj which I had accidentally left:
\<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" \/>
I'm curious if anyone on this thread is seeing the issue but does not have ReSharper installed and enabled.
I ran into this issue on a computer where I have not installed ReSharper. I first tried deleting the obj and bin folders and then re-publishing, but it wasn't until I upgraded VS to the latest version (15.9.4) that the issue went away.
I did not try restarting VS prior to upgrading it, so I cannot say whether a restart of VS would've solved the issue for me.
Same issue; editing .pubxml file manually was the only solution. VS 15.9.5; this happened when updating my project from .NET Core 2.1 to 2.2. Tried closing VS, deleting obj and bin folders, then re-opening, but that didn't fix it. Unlike an earlier comment, when I opened the Publish page, the "Target Framework" correctly showed "netcoreapp2.2", but when I opened the pubxml file, it was set to 2.1, not 2.2.
Never had Resharper installed.
I'm surprised a moderator kicked this over to NuGet. It's really the responsibility of NuGet to update Publish profiles when the project is restored with a newer version of .NET Core?
In my case, I just had to rec-create my publish profile. That ensured everything was in sync.
Same issue on VS2019 Community and the solution of @dhieyson works for me.
I am running Visual Studio 2019.
Deleting the obj and bin folders seems to work just fine. No need to update any other settings.
I am running Visual Studio 2019.
1) Delete the obj and bin folders
2) Add line below to the csproj file, beneath the <TargetFramework>netcoreapp3.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
3) Restart Visual Studio 4) Publish project
Ran into w/2019 - even though all targets were changed to 3.0 and bin and objs were removed. The Publish profile was not changed and had to be manually modified: altering the pubxml file fixed the issue.
Add line below to the csproj file, beneath the \
as @alexreich said, check your PublishProfiles files they can target other target Framework if you are doing a migration
Still an issue in VS2019 16.6. Reopening the solution fixed it.
I resolved this issue after trying absolutely everything in this thread (on the latest version of VS 2019 enterprise). It seems liked putting a project and solution in the same directory as the solution is no bueno. For example:
This is bad:
- Solution.sln
- Project.csproj
- Startup.cs
- Program.cs
- /OtherProject
- OtherProject.csproj
...
...
This is good:
- Solution.sln
- /Project
- Project.csproj
- Startup.cs
- Program.cs
- /OtherProject
- OtherProject.csproj
...
...
Still an issue in VS2019 16.7.6
Having this issue in VS4Mac 8.7.9 (build 9)
I suddenly got this issue even though it was working fine 5 minutes ago, VS Studio 8.7.9 (build 9) Mac OS
Nothing works for me but after updating the VS 22, fixed my issue.
Thanks all. :)
@alexvy86 Not sure this would help, but I had the same issue when trying to build net40 project after building netstandard2.0 project, and both projects files are in the same folder.
What resolves the issue for me is manually deleting the
\obj\project.assets.json
file, which tends to break the build for the net40 project, if present, with the following error: Your project is not referencing the ".NETFramework,Version=v4.0,Profile=Client" framework. Add a reference to ".NETFramework,Version=v4.0,Profile=Client" in the "frameworks" section of your project.json, and then re-run NuGet restore.
Hi @bsivanov, you mentioned manually deleting the \obj\project.assets.json
file - which will do the job, works for me too.
You must have had some issues when taking these projects to some DevOps pipeline and trying to build. Have you tweaked pre-build/post-build events to delete \obj\project.assets.json
file, or something similar?
From @kosa-gyula-77 on June 8, 2017 14:27
Publishing the xunitCore1.0 project in the solution attached from Visual Studio 2017 fails with the following error:
Assets file 'C:\Users\xxx\Documents\Visual Studio 2017\Projects\xunitCore1.0\xunitCore1.0\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v1.1'. Ensure you have restored this project for TargetFramework='netcoreapp1.1' and RuntimeIdentifier=''.
Could you please help in identifying why I'm getting this error? xunitCore1.0 targets netcoreapp1.0.
xunitCore1.0.zip
Thanks.
Copied from original issue: Microsoft/msbuild#2196