-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Labels
bugSomething isn't workingSomething isn't workinghelp wantedLooking for community contributions!Looking for community contributions!
Description
SlnGen succeeds when using msbuild but fails when using dotnet restore.
msbuild /restore /t:SlnGen dirs.proj // successful
dotnet restore /t:SlnGen dirs.proj // fail
Reproduce setup:
OS: Windows 11 23H2 Build 22631.3007
Visual Studio version: VS Community 2022 17.8.3
File structure:
-
|-dirs.proj
|-global.json
|-directory.build.props
|-directory.packages.props
|-src
|-dirs.proj
|-ConsoleApp
|-ConsoleApp.csproj
|-Program.cs
File content:
dirs.proj
<Project Sdk="Microsoft.Build.Traversal">
<ItemGroup>
<ProjectReference Include="src\dirs.proj" />
</ItemGroup>
</Project>
global.json
{
"msbuild-sdks": {
"Microsoft.Build.Traversal": "4.1.0"
}
}
directory.build.props
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<SlnGenSolutionFileFullPath>$(MSBuildProjectDirectory)\dirs.sln</SlnGenSolutionFileFullPath>
<SlnGenLaunchVisualStudio>false</SlnGenLaunchVisualStudio>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.SlnGen" />
</ItemGroup>
</Project>
directory.packages.props
<Project>
<ItemGroup>
<PackageVersion Include="Microsoft.VisualStudio.SlnGen" version="11.1.0" />
</ItemGroup>
</Project>
src/dirs.proj
<Project Sdk="Microsoft.Build.Traversal">
<ItemGroup>
<ProjectReference Include="ConsoleApp\ConsoleApp.csproj" />
</ItemGroup>
</Project>
src/ConsoleApp/ConsoleApp.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
src/ConsoleApp/Program.cs
Console.WriteLine("Hello, World!");
Output:
C:\Workspace\SlnGenRepro>msbuild /Restore /t:SlnGen dirs.proj
MSBuild version 17.8.3+195e7f5a3 for .NET Framework
Build started 1/17/2024 2:57:47 AM
......
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:05.94
C:\Workspace\SlnGenRepro>dotnet restore /t:SlnGen
Determining projects to restore...
All projects are up-to-date for restore.
C:\Users\<user-name>\.nuget\packages\microsoft.visualstudio.slngen\11.1.0\build\Microsoft.VisualStudio.SlnGen.targets(30,5):
error MSB6006: "slngen" exited with code -2147450730. [C:\Workspace\SlnGenRepro\dirs.proj]
C:\Workspace\SlnGenRepro>
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedLooking for community contributions!Looking for community contributions!