You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When following the Community Toolkit instructions for SQL Database Projects I consistently run into issues with MSBuild not being available.
Regression
No response
Steps to reproduce
1. Environment: Visual Studio 2022 Pro, .NET 8.0, Aspire 9.0.
2. Create new .NET Aspire Starter App (Blazor front end, API backend service)
3. `dotnet tool install -g microsoft.sqlpackage`
4. `dotnet new -i Microsoft.Build.Sql.Templates`
5. `dotnet new sqlproj -n ProductsTutorial`
6. Solution > Add Existing > ProductsTutorial.sqlproj
7. Add .sqlproj reference to AppHost project
8. Add `CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects` nuget package to AppHost
9. AppHost Program.cs code:
var builder = DistributedApplication.CreateBuilder(args);
var sql = builder.AddSqlServer("sql")
.AddDatabase("test");
builder.AddSqlProject<Projects.ProductsTutorial>("mysqlproj")
.WithReference(sql);
var apiService = builder.AddProject<Projects.AspireApp3_ApiService>("apiservice");
builder.AddProject<Projects.AspireApp3_Web>("webfrontend")
.WithExternalHttpEndpoints()
.WithReference(apiService)
.WaitFor(apiService);
builder.Build().Run();
10. Start/debug project
11. Error received
When commenting out builder.AddSqlProject the app starts and works as expected. The sqlproj project also works independently if I schema compare or apply changes to the SQL Server created by Aspire.
System.TypeInitializationException: 'The type initializer for 'Aspire.Hosting.SqlProjectBuilderExtensions' threw an exception.'
InvalidOperationException: No instances of MSBuild could be detected.
Try calling RegisterInstance or RegisterMSBuildPath to manually register one
Expected behavior
I would expect a SQL Server container to be created with a default database and a dacpac applied to the instance
@ebaker-sogeti Could be your VS or .NET SDK install that is broken, to to re-install the .NET 8 SDK and repair VS.
Thanks Erik - I went through and repaired Visual Studio and also uninstalled .NET 8 components, .NET Aspire SDK, and MSBuild and I am still seeing the same thing.
@jmezach I am going to review this list in the afternoon, thank you for the suggestion.
Describe the bug
When following the Community Toolkit instructions for SQL Database Projects I consistently run into issues with MSBuild not being available.
Regression
No response
Steps to reproduce
Expected behavior
I would expect a SQL Server container to be created with a default database and a dacpac applied to the instance
Screenshots
IDE and version
VS 2022
IDE version
17.13.0
Nuget packages
Additional context
No response
Help us help you
Yes, but only if others can assist
The text was updated successfully, but these errors were encountered: