Skip to content

Fix build issue from NuGet.Frameworks conflict - #3350

Open
ds5678 wants to merge 3 commits into
stride3d:masterfrom
ds5678:fix-nuget-frameworks-build-issue
Open

Fix build issue from NuGet.Frameworks conflict#3350
ds5678 wants to merge 3 commits into
stride3d:masterfrom
ds5678:fix-nuget-frameworks-build-issue

Conversation

@ds5678

@ds5678 ds5678 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

PR Details

This fixes an issue I encountered with building Stride.

Related Issue

When I try to build Stride, I get 9 errors similar to this:

106>  Stride.Core.Tasks.dll: Microsoft.Build.Exceptions.InvalidProjectFileException: The expression "[MSBuild]::GetTargetFrameworkIdentifier(net10.0-windows)" cannot be evaluated. Could not load file or assembly 'NuGet.Frameworks, Version=7.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)  C:\Program Files\dotnet\sdk\10.0.400-preview.0.26322.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets
106>     at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
106>     at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1,T2](IElementLocation elementLocation, String resourceName, T1 arg0, T2 arg1)
106>     at Microsoft.Build.Evaluation.Expander`2.Function.Execute(Object objectInstance, IPropertyProvider`1 properties, ExpanderOptions options, IElementLocation elementLocation)
106>     at Microsoft.Build.Evaluation.Expander`2.PropertyExpander.ExpandPropertyBody(String propertyBody, Object propertyValue, IPropertyProvider`1 properties, ExpanderOptions options, IElementLocation elementLocation, PropertiesUseTracker propertiesUseTracker, IFileSystem fileSystem)
106>     at Microsoft.Build.Evaluation.Expander`2.PropertyExpander.ExpandPropertiesLeaveTypedAndEscaped(String expression, IPropertyProvider`1 properties, ExpanderOptions options, IElementLocation elementLocation, PropertiesUseTracker propertiesUseTracker, IFileSystem fileSystem)
106>     at Microsoft.Build.Evaluation.Expander`2.ExpandIntoStringLeaveEscaped(String expression, ExpanderOptions options, IElementLocation elementLocation)
106>     at Microsoft.Build.Evaluation.Evaluator`4.EvaluatePropertyElement(ProjectPropertyElement propertyElement)
106>     at Microsoft.Build.Evaluation.Evaluator`4.EvaluatePropertyGroupElement(ProjectPropertyGroupElement propertyGroupElement)
106>     at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
106>     at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
106>     at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
106>     at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
106>     at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
106>     at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
106>     at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
106>     at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
106>     at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
106>     at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
106>     at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
106>     at Microsoft.Build.Evaluation.Evaluator`4.Evaluate()
106>     at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ICollection`1 propertiesFromCommandLine, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, IDirectoryCacheFactory directoryCacheFactory, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive)
106>     at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
106>     at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
106>     at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, Boolean interactive)
106>     at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory, Boolean interactive)
106>     at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
106>     at Stride.Core.Assets.VSProjectHelper.LoadProject(String fullProjectLocation, String configuration, String platform, Dictionary`2 extraProperties) in E:\repos\stride\sources\assets\Stride.Core.Assets\VSProjectHelper.cs:line 224
106>     at Stride.Core.Assets.Package.FindAssetsInProject(String projectFullPath, String& nameSpace) in E:\repos\stride\sources\assets\Stride.Core.Assets\Package.cs:line 1305
106>     at Stride.Core.Assets.Package.FindAssetsInProject(ICollection`1 list, Package package) in E:\repos\stride\sources\assets\Stride.Core.Assets\Package.cs:line 1343
106>     at Stride.Core.Assets.Package.ListAssetFiles(Package package, Boolean listAssetsInMsbuild, Boolean listUnregisteredAssets) in E:\repos\stride\sources\assets\Stride.Core.Assets\Package.cs:line 1296
106>     at Stride.AssetCompiler.Tasks.PackAssetsHelper.Run(Logger logger, String projectFile, String intermediatePackagePath, List`1 generatedItems, IReadOnlyList`1 assetAssemblies, String assetNamespace) in E:\repos\stride\sources\assets\Stride.AssetCompiler\Tasks\PackAssets.cs:line 100
106>     at Stride.Core.Tasks.Program.RealMain(String[] args) in E:\repos\stride\sources\core\Stride.Core.Tasks\Program.cs:line 107
106>E:\repos\stride\sources\sdk\Stride.Build.Sdk\Sdk\Sdk.targets(265,5): error MSB3073: The command "dotnet "E:\repos\stride\sources/core/Stride.Core.Tasks/bin/Debug/net10.0/Stride.Core.Tasks.dll" pack-assets "Stride.Assets.Presentation.csproj" "obj\Debug\net10.0-windows\stride"" exited with code 1.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

@Kryptos-FR

Kryptos-FR commented Aug 11, 2026

Copy link
Copy Markdown
Member

The two issues mentioned are for .NET SDK 8 and 9, but we are already on 10. How does it affect us? I have no issue with building on my end. Seems to be a recurrent issue with incompatible SDKs that target a different version.

edit: looks like you are using a preview version of the SDK as well.

edit 2: I wonder if we should also enforce the version of the SDK to use in the global.json file. If "latestMinor" doesn't exclude preview version then maybe we should use "minor" instead.

@ds5678

ds5678 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Seems to be a recurrent issue with incompatible SDKs that target a different version.

Yes

looks like you are using a preview version of the SDK as well

Not on purpose

I wonder if we should also enforce the version of the SDK to use in the global.json file. If "latestMinor" doesn't exclude preview version then maybe we should use "minor" instead.

Changing the global.json file to disallow prerelease versions of .NET fixed my issue.

@xen2

xen2 commented Aug 11, 2026

Copy link
Copy Markdown
Member

Just so I understand, was it using a prerelease of .NET 10 or .NET 11?
Can you tell me which version it was using exactly?

@ds5678

ds5678 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Just so I understand, was it using a prerelease of .NET 10 or .NET 11? Can you tell me which version it was using exactly?

10.0.400-preview.0.26322.102

@VaclavElias

VaclavElias commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

I have just updated Stride to these and I can build, without that I would have the same error

<PackageVersion Include="Microsoft.NET.StringTools" Version="18.9.6" />
<PackageVersion Include="Microsoft.Build" Version="18.9.6" />
<PackageVersion Include="Microsoft.Build.Framework" Version="18.9.6" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="18.9.6" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="18.9.6" />

<PackageVersion Include="NuGet.Commands" Version="7.9.0" />
<PackageVersion Include="NuGet.Configuration" Version="7.9.0" />
<PackageVersion Include="NuGet.PackageManagement" Version="7.9.0" />
<PackageVersion Include="NuGet.ProjectModel" Version="7.9.0" />
<PackageVersion Include="NuGet.Protocol" Version="7.9.0" />
<PackageVersion Include="NuGet.Resolver" Version="7.9.0" />

@VaclavElias

Copy link
Copy Markdown
Contributor

I added these as well, but I'm not sure if it's human error, sleep deprivation, or a critical coffee dependency failure.

Directory.Packages.props
Add: <PackageVersion Include="Microsoft.Extensions.FileProviders.Abstractions" Version="10.0.11" />

Stride.AssetCompiler.csproj
Add: <PackageReference Include="Microsoft.Extensions.FileProviders.Abstractions" />

Stride.ConnectionRouter.csproj
Add: <PackageReference Include="Microsoft.Extensions.FileProviders.Abstractions" />

@ds5678
ds5678 force-pushed the fix-nuget-frameworks-build-issue branch from b13db69 to 856debf Compare August 12, 2026 21:18
@ds5678

ds5678 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

After updating Visual Studio, I had the non-prelease 10.0.400 .NET version on my computer and encountered issues with the pure global.json fix. The changes that @VaclavElias mentioned didn't help me, so I went back to my original solution. My original solution appears to be more durable and enabled Stride compilation on 10.0.400 without bumping any package reference versions.

@VaclavElias

Copy link
Copy Markdown
Contributor

@ds5678 , your changes are working for me but I didn't have to touch global.json, just the other two files. Thanks, I can continue my work 🤣

@ds5678

ds5678 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

The global.json change isn't necessary for me either. I left it in because I thought using pre release sdks was unintended behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants