question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Error NETSDK1005 after changes in .csproj file

See original GitHub issue

Description

I’ve created a new .NET MAUI app using the latest RC1 version. I’m opening the project file of the project and do some changes like chaing the ApplicationTitle or the ApplicationDisplayVersion. If I’m now also updating the Color of the MauiSplashScreen the app won’t build with the error NETSDK1005. Also undo the latest changes won’t fix the issue.

Steps to Reproduce

  1. Create a new .NET MAUI app
  2. Edit the project file
  3. Update ApplicationTitle, ApplicationDisplayVersion, Color of MauiSplashScreen

Version with bug

Release Candidate 1

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows, I was not able test on other platforms

Affected platform versions

Android 11, Windows 10.0.19041

Did you find any workaround?

Relevant log output

error NETSDK1005: Assets file '\obj\project.assets.json' doesn't have a target for 'net6.0-windows10.0.19041'. Ensure that restore has run and that you have included 'net6.0-windows10.0.19041' in the TargetFrameworks for your project.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:24 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
jonathanpepperscommented, May 6, 2022

@KiristonK did you already try setting $(ApplicationDisplayVersion) and $(Version) to the same value? I don’t see that in your screenshots.

The fix for this is not released yet.

0reactions
mattleibowcommented, May 24, 2023

I believe that the issue you are seeing @Redth is https://github.com/dotnet/maui/issues/10579 or #12859

This particular one was a result for the TFMs being passed as windows to all dependencies. I moved the code we added back into the workload but nothing changed. And looking at what we have, the code that sets the property is only imported using:

<Import Project="WinUI.targets" Condition=" '$(TargetPlatformIdentifier)' == 'windows' and '$(WindowsAppSDKWinUI)' == 'true'" />

This had a condition for the Windows TFM and the WindowsAppSDKWinUI property - which is only set by the Windows App SDK NuGet - after the install has completed. So this never ran on before the restore.

I tested this with the latest stable .NET MAUI - 7.0.86 - and I was able to reproduce this by simply updating the 2 properties (only the first matters really):

<ApplicationDisplayVersion>2.0</ApplicationDisplayVersion>
<ApplicationVersion>2</ApplicationVersion>
Read more comments on GitHub >

github_iconTop Results From Across the Web

NETSDK1005 and NETSDK1047: Asset file is missing target
When the .NET SDK issues error NETSDK1005 or NETSDK1047, the project's assets file is missing information on one of your target frameworks.
Read more >
Assets file project.assets.json doesn't have a target for 'net6.0'
For me, this happened after switching from .net6.0 to .net 7.0 in asp.net core / blazor project. The error occured when trying to...
Read more >
NuGet Restore build issues - project.assets.json doesn't ...
error NETSDK1005 : Assets file 'C:\git…\obj\project.assets.json' doesn't have a target for 'net48'. Ensure that restore has run and that you ...
Read more >
.Net5 - error NETSDK1005: Assets file doesn't have a target
I recently got the error code "NETSDK1005" when i tried to run (dotnet run) my application. Here is how I fixed it.
Read more >
MAUI project will not compile for iOS #4976 - ABP Commercial
Currently, when I try to compile the app I get the following error: error NETSDK1005: Assets file 'Z:\Projects\xxxx\aspnet-core\src\xxxx.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found