Hi,
Merry Christmas, all the best to you and all the developers - thanks for a great product.
Today I stumbled on an issue however. In my existing solution, I wanted to start checking out Aspire.
So I created a solution folder, and added a new project, using the default template for ".Net Aspire Starter App". (VS2022 preview (latest update at the moment), Aspire 9.0, dotnet 8, ncrunch 5.11.0.1 - of course I can provide more details if needed)
(using all defaults)
NCrunch has a problem building two of the auto-generated projects out of the box. Maybe I need to tweak some configuration settings for these ?
The first project would be the following auto-generated MyApp.Aspire.AppHost.csproj.
Quote:
<Project Sdk="Microsoft.NET.Sdk">
<Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
<UserSecretsId>some-secret-id-here</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\MyApp.Aspire.ApiService\MyApp.Aspire.ApiService.csproj" />
<ProjectReference Include="..\MyApp.Aspire.Web\MyApp.Aspire.Web.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.0.0" />
</ItemGroup>
</Project>
In it are a regular appsettings.json and an auto-generated Program.cs
Quote:
var builder = DistributedApplication.CreateBuilder(args);
var apiService = builder
.AddProject<Projects.MyApp_Aspire_ApiService>("apiservice");
builder.AddProject<Projects.MyApp_Aspire_Web>("webfrontend")
.WithExternalHttpEndpoints()
.WithReference(apiService)
.WaitFor(apiService);
builder
.Build()
.Run();
However, it turns out nCrunch cannot this project.
In the generics in Program.cs builder makes use of a design-time generated class for each referenced project, but nCrunch probably has no way of finding those classes.
I can find three generated files in **my_base_path**\MyApp.Aspire.AppHost\obj\Debug\net8.0\Aspire\references\
_AppHost.ProjectMetadata.g.cs
MyApp_Aspire_ApiService.ProjectMetadata.g.cs
MyApp_Aspire_Web.ProjectMetadata.g.cs
In the last two files I can find the classes I talked about.
Should I change something in the ncrunch project configuration to make the magic happen ?
NCrunch build output for this project says:
Quote:NCrunch: If you are experiencing problems in getting this project to build, have a look at
https://www.ncrunch.net/...ng_project-build-issues
Program.cs (4, 26): The type or namespace name 'MyApp_Aspire_ApiService' does not exist in the namespace 'Projects' (are you missing an assembly reference?)
Program.cs (6, 29): The type or namespace name 'MyApp_Aspire_Web' does not exist in the namespace 'Projects' (are you missing an assembly reference?)
The second project would be the auto-generated test project. (probably for the same reason, but nCrunch does not provide build/error output for this one)