-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Can no longer compile any project after upgrading from .NET 9.0 Preview 7 to .NET 9.0 RC1 #43339
Comments
We are encountering this in Uno Platform as well once we updated to RC1 |
What I find strange is the version number. Should it really be 8.0.0.4? The latest stable NuGet package version is 8.0.4 |
Only in Uno Platform though? I'm having this issue in every project. I can start a new solution, add a class library with nothing in it, try to compile and I get that error. |
It shouldn't be specific to Uno Platform, just mentioning that we are also unable to upgrade to RC1 due to this issue |
Quite likely, possibly this commit: 337965f In my SDK folder I have 8 files called System.Text.Json.dll Four are file version 9.0.24.43107 None of them are 8.0.0.4 |
https://nuget.info/packages/System.Text.Json/8.0.4 shows https://nuget.info/packages/System.Text.Json/9.0.0-rc.1.24431.7 shows both |
I meet this problem too! |
But then you wouldn't be able to compile .NET 9 projects, no? |
Yes! I think you can down grade it to preview7 first. |
Looks like it's a known issue: https://github.com/dotnet/core/pull/9489/files |
I hoped this App.config would help but it really didn't. Maybe I am missing something. <?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="8.0.0.4" newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> |
I confirm that this is a Visual Studio issue. I was able to |
@MarkCiliaVincenti, which App.config file did you modify? It might need to be |
Interesting, but I'm not sure what I'm supposed to do here. I tried this but it didn't work:
to:
|
Moved to #43356 |
This is a known issue with the combination of Visual Studio 17.11 and .NET SDK 9.0.100-rc.1. It will be addressed in a future Visual Studio 17.11.x release. Per the .NET SDK support matrix, you must use Visual Studio 17.12-preview to target .NET 9 from within Visual Studio. That’s the best way to get things working today. To target .NET 8 or lower, there are a couple of workaround options while you wait for the fix (dotnet/msbuild#10650) to be available:
|
@leppie please file a separate issue, that doesn't sound like this one. |
@rainersigwald The problem for us is mostly with CI scenarios where hosted agents don't yet contain 17.12. If there are ugly workarounds to use rc1 with 17.11.2 (e.g, messing up with System.Text.Json in the .NET installation or really anything else), we'd love to hear. |
working on it |
This works around dotnet/sdk#43339 by preloading a copy of the assembly that can't be located with the normal load processes. It should be harmless (other than wasting time) in circumstances where it's not necessary.
WorkaroundThis workaround can be checked into any affected repo, but should be removed as soon as possible. Add the following to a <!-- BEGIN workaround for https://github.com/dotnet/sdk/issues/43339; remove after updated to VS 17.12 or a future 17.11 patch -->
<Target Name="WorkaroundDotnetSdk43339" BeforeTargets="ResolvePackageAssets" Condition=" '$(MSBuildRuntimeType)' == 'Full' and $([MSBuild]::VersionLessThan($(MSBuildVersion), 17.12.0))">
<PrimeSystemTextJson804 />
</Target>
<UsingTask
TaskName="PrimeSystemTextJson804"
TaskFactory="RoslynCodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
<Task>
<Code Type="Fragment" Language="cs">
<![CDATA[
try
{
System.Reflection.Assembly.LoadFrom(@"$(MicrosoftNETBuildTasksDirectoryRoot)\..\..\..\DotnetTools\dotnet-format\BuildHost-net472\System.Text.Json.dll");
}
catch
{
// Best effort: if something moves in the SDK don't break the build.
}
]]>
</Code>
</Task>
</UsingTask>
<!-- END workaround for https://github.com/dotnet/sdk/issues/43339 --> It's working for the MSBuild repo; see dotnet/msbuild#10643. |
Can confirm. I was eager to try .NET 9 RC 1 but nothing will build in Visual Studio 2022 Community edition now. |
Since Visual Studio 2022 v17.11.4 is out, this problem is fixed. |
This reverts commit fa5202f.
Still occours on azure using a .net8 web app which used msbuild .net9 for compiling on AZURE SolutionDeleting the dev slot on the azure portal and deploying on a brand new slot solved the issue. For the ones who might end up here having the same issue ^^ |
Unfortunately, we still got the same error on a brand new slot. I'm hoping the Azure/.NET folks eventually get this sorted. We normally stay on LTS versions but wanted to observe the performance improvements of .NET 9 in a test environment. |
Also getting the same error on a .net6 MVC azure webapp. Yesterday, I added some minor code and pushed it to my Devops repository which is linked via Pipeline to a staging slot on my Webapp (via Deployment Center section). This has all been working fine for many months but yesterday, it started failing.
I was able to deploy directly from local to a brand new slot on azure like skyslide recommended |
Either deploying directly from my machine or making a brand new slot with a new different name than before worked for me on azure |
@mdgibbons assuming this is a Windows Web App, the error message indicates that your application is using SDK version 9.0.100. You can specify an earlier SDK version for the web app manually. To do this, follow these steps:
By doing this, the Azure Web App will use the specified .NET SDK version (8.0.400). |
I am getting this same issue when deploying to an Azure Function App. We are upgrading from net6.0 to net8.0 with the isolated worker model. The function app is configured to use .NET 8 Isolated. Anyone else with this issue in an Azure Function App? |
After I compiled the first project with .NET 9 in our build servers (Azure DevOps Pipeline) the code starts failing with that error. Using a global.json fixed everything that still uses .NET 8, but we are unable to compile anything that target .NET 9. Everything runs fine locally to all developers of the team. I've tried putting the workaround in the Directory.Build.targets, but it does not work. The only thing that seemed to work was installing vs preview on build servers.
|
Just updated to latest VS (v17.12.3) and am now seeing this error for any project targeting .NET 8:
|
* Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 10000931 (#10267) * Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 9752299 * Increase VersionPrefix version --------- Co-authored-by: Jenny Bai <v-jennybai@microsoft.com> * [17.11] Fix component governance alerts (#10520) * Resolves CG alerts --------- Co-authored-by: Rainer Sigwald <raines@microsoft.com> * Assembly redirect fix (#10624) * Fixing the assembly redirect * [vs17.11] Update dependencies from dotnet/arcade (#10654) * Update dependencies from https://github.com/dotnet/arcade build 20240910.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.24311.3 -> To Version 8.0.0-beta.24460.4 * version bump --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Mariana Garces Dematte <magarces@microsoft.com> * Upgrade system.text.json to 8.0.4 (#10650) Will address dotnet/sdk#43339 when deployed in VS. --------- Co-authored-by: Rainer Sigwald <raines@microsoft.com> * disable loc (#10693) Part of: #10665 Disabling localization for 17.11. * [vs17.11] Update dependencies from dotnet/arcade (#10691) * [vs17.11] Update dependencies from dotnet/arcade (#10793) * Update dependencies from https://github.com/dotnet/arcade build 20241008.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.24475.3 -> To Version 8.0.0-beta.24508.1 * bump the version --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com> * CG alert cleaning on VS17.11 (#10723) * Bump Microsoft.IO.Redist to 6.0.1 * Bump version prefix to 17.11.11 * [vs17.11] Update dependencies from dotnet/arcade (#10832) * [vs17.11] Update dependencies from dotnet/arcade (#10895) * [vs17.11] Update dependencies from dotnet/arcade (#10990) * Update dependencies from https://github.com/dotnet/arcade build 20241112.12 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.24525.2 -> To Version 8.0.0-beta.24562.12 * Update VersionPrefix to 17.11.16 --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Gang Wang <v-gaw@microsoft.com> * Update dependencies from https://github.com/dotnet/arcade build 20241120.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.24562.12 -> To Version 8.0.0-beta.24570.5 * Update VersionPrefix to 17.11.17 * [vs17.11] Run tests even if version is not bumped (#11060) Backport of #11042 to vs17.11 * [vs17.11] Backport VS insertion pipeline YMLs (#11064) Co-authored-by: Jan Provaznik <janprovaznik@microsoft.com> * Eliminate the unnecessary change from vs17.11 * Remove duplicate version setting for System.Formats.Asn1 * Bump up version prefix to 17.12.18 --------- Co-authored-by: dotnet bot <dotnet-bot@dotnetfoundation.org> Co-authored-by: Jenny Bai <v-jennybai@microsoft.com> Co-authored-by: MichalPavlik <michalpavlik@outlook.com> Co-authored-by: Rainer Sigwald <raines@microsoft.com> Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Mariana Garces Dematte <magarces@microsoft.com> Co-authored-by: YuliiaKovalova <95473390+YuliiaKovalova@users.noreply.github.com> Co-authored-by: Gang Wang <v-gaw@microsoft.com> Co-authored-by: Surayya Huseyn Zada <114938397+surayya-MS@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jan Provaznik <janprovaznik@microsoft.com>
The steps I took:
Every project I try compiling I'm getting this error even though it's not referencing System.Text.Json, even transitively.
C:\Program Files\dotnet\sdk\9.0.100-rc.1.24452.12\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1060: Error reading assets file: Error loading lock file 'C:[....]\obj\project.assets.json' : Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
I tried redownloading and reinstalling, repairing, deleted the NuGet package cache, manually deleted the bin and obj folders, rebooted the PC... basically everything I could think of
The text was updated successfully, but these errors were encountered: