mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 23:07:23 +00:00
254 lines
15 KiB
XML
254 lines
15 KiB
XML
<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
|
|
<!-- Using Microsoft.Build.Tasks.Core.dll to be able to read files -->
|
|
<UsingTask TaskName="ReadLinesFromFile" AssemblyFile="$(MSBuildBinPath)\Microsoft.Build.Tasks.Core.dll" />
|
|
|
|
<PropertyGroup>
|
|
<Authors>Thorsten Sommer</Authors>
|
|
<TargetFramework>net10.0</TargetFramework>
|
|
<Nullable>enable</Nullable>
|
|
<WarningsAsErrors>CS8600;CS8602;CS8603;CS9057</WarningsAsErrors> <!-- CS9057: fail instead of silently skipping an analyzer which needs a newer compiler than the SDK's -->
|
|
<ImplicitUsings>enable</ImplicitUsings>
|
|
<RootNamespace>AIStudio</RootNamespace>
|
|
<AssemblyName>mindworkAIStudio</AssemblyName>
|
|
|
|
<PublishSingleFile>true</PublishSingleFile> <!-- Publish as single file -->
|
|
<SelfContained>true</SelfContained> <!-- Publish as self-contained; requires no .NET runtime installed on the target machine -->
|
|
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> <!-- Include native libraries for self-extract -->
|
|
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest> <!-- Generate embedded files manifest -->
|
|
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> <!-- Restore packages with lock file, so that every restore resolves exactly the same package versions -->
|
|
|
|
<!--
|
|
SelfContained makes the SDK pick the RID of the machine which runs the restore, and the lock file
|
|
records that RID. Without a fixed list, a restore on any other platform rewrites the lock file.
|
|
Hence, we list all six RIDs we ship, so that the lock file stays the same everywhere. When we add a
|
|
platform, add its RID here as well. The price: each restore downloads the runtime packs of all six
|
|
platforms. Please note that `dotnet restore -r` replaces this list; use a plain `dotnet restore` or
|
|
`dotnet publish -r` instead.
|
|
-->
|
|
<RuntimeIdentifiers>osx-arm64;osx-x64;linux-x64;linux-arm64;win-x64;win-arm64</RuntimeIdentifiers>
|
|
|
|
<!--
|
|
The Web SDK defaults to server GC. AI Studio is a single-user desktop app, though: workstation
|
|
GC collects earlier and returns the memory to the OS sooner. This matters for devices with
|
|
little RAM, e.g., a Raspberry Pi. Please note that we override an SDK default here, so this is
|
|
not a redundant repetition of the default value.
|
|
-->
|
|
<ServerGarbageCollection>false</ServerGarbageCollection>
|
|
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
|
|
|
|
<!--
|
|
IL2026: Usage of methods marked as RequiresUnreferencedCode, e.g., every call of JsonSerializer. Partial trim mode
|
|
keeps our own types, so this is no issue for them. It is for types of .NET which System.Text.Json reaches by
|
|
reflection only, see the TrimmerRootAssembly in Trimming.props.
|
|
CS8974: Converting method group to non-delegate type; Did you intend to invoke the method? We have this issue with MudBlazor validation methods.
|
|
-->
|
|
<NoWarn>IL2026, CS8974</NoWarn>
|
|
<LangVersion>latest</LangVersion>
|
|
|
|
<!--
|
|
Since .NET 10, the scripts of Blazor come from a package, which the release embeds: see the
|
|
EmbedBlazorScript target. The SDK adds that package by itself when it spots Razor files; we
|
|
ask for it here, so that the release does not hinge on that guess.
|
|
-->
|
|
<RequiresAspNetWebAssets>true</RequiresAspNetWebAssets>
|
|
</PropertyGroup>
|
|
|
|
<Import Project="..\Trimming.props" />
|
|
|
|
<ItemGroup>
|
|
<!-- Remove some files from the solution view -->
|
|
<None Remove="Properties\launchSettings.json" />
|
|
<None Remove="build.nu" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup>
|
|
<!-- The app serves no pre-compressed copies and no source maps, see UpdateWebAssetsCommand -->
|
|
<EmbeddedResource Include="wwwroot\**" Exclude="wwwroot\**\*.br;wwwroot\**\*.gz;wwwroot\**\*.map" CopyToOutputDirectory="PreserveNewest" />
|
|
<EmbeddedResource Include="Plugins\**" CopyToOutputDirectory="PreserveNewest" />
|
|
<EmbeddedResource Include="Assistants\I18N\allTexts.lua" CopyToOutputDirectory="PreserveNewest" />
|
|
<EmbeddedResource Include="Assistants\PromptOptimizer\prompting_guideline.md" CopyToOutputDirectory="PreserveNewest" />
|
|
<EmbeddedResource Include="Assistants\Builder\AssistantBuilderLuaResponse.schema.json" CopyToOutputDirectory="PreserveNewest" />
|
|
<EmbeddedResource Include="Assistants\VisualBriefing\Runtime\echarts.common.min.js" CopyToOutputDirectory="PreserveNewest" />
|
|
<EmbeddedResource Include="..\..\runtime\icons\128x128.png" LogicalName="AIStudio.Assistants.VisualBriefing.Runtime.mindwork-ai-studio-icon.png" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup>
|
|
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="9.2.0" />
|
|
<PackageReference Include="DocumentFormat.OpenXml" Version="3.5.1" />
|
|
<PackageReference Include="HtmlAgilityPack" Version="1.12.4" />
|
|
<PackageReference Include="MailKit" Version="4.18.2" />
|
|
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="10.0.14" />
|
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.14" />
|
|
|
|
<!--
|
|
Its assembly ships with ASP.NET Core, but the package also brings the build logic which writes the
|
|
manifest of the embedded files. Without that manifest, the release serves no static files at all, and
|
|
WebRootFiles finds neither the changelogs nor the ERI specifications in any build.
|
|
-->
|
|
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="10.0.14" />
|
|
<PackageReference Include="MudBlazor" Version="9.12.0" />
|
|
<PackageReference Include="MudBlazor.Markdown" Version="9.10.0" />
|
|
<PackageReference Include="ReverseMarkdown" Version="5.0.0" />
|
|
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.5" />
|
|
<PackageReference Include="LuaCSharp" Version="0.5.8" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup>
|
|
<ProjectReference Include="..\SharedTools\SharedTools.csproj" />
|
|
<ProjectReference Include="..\SourceCodeRules\SourceCodeRules\SourceCodeRules.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
|
|
<ProjectReference Include="..\SourceGeneratedMappings\SourceGeneratedMappings.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
|
|
</ItemGroup>
|
|
|
|
<ItemGroup>
|
|
<Folder Include="Plugins\assistants\assets\" />
|
|
</ItemGroup>
|
|
|
|
<!--
|
|
The test project has to reach Program.LOGGER_FACTORY. Program is internal, and it stays that
|
|
way: it is the entry point, not API. Several types initialize a static logger field from that
|
|
factory, so a test process must assign it before it touches any of them. The trim smoke test
|
|
needs the same, and it uses the internal JSON options of the settings and the Visual Briefing.
|
|
-->
|
|
<ItemGroup>
|
|
<InternalsVisibleTo Include="Tests" />
|
|
<InternalsVisibleTo Include="TrimSmokeTest" />
|
|
</ItemGroup>
|
|
|
|
<!-- Read the meta data file -->
|
|
<Target Name="ReadMetaData" BeforeTargets="BeforeBuild">
|
|
<Error Text="The ../../metadata.txt file was not found!" Condition="!Exists('../../metadata.txt')" />
|
|
|
|
<ReadLinesFromFile File="../../metadata.txt">
|
|
<Output TaskParameter="Lines" PropertyName="Metadata" />
|
|
</ReadLinesFromFile>
|
|
|
|
<!--
|
|
metadata.txt names the .NET SDK which the pipeline pins, but a local build may use another
|
|
one. Hence, we take the SDK which builds right now. Its .version file starts with the commit
|
|
it was built from. The .NET runtime is not recorded at all: the app asks for it while it runs.
|
|
-->
|
|
<PropertyGroup>
|
|
<DotnetSdkVersionFile>$(NetCoreRoot)sdk/$(NETCoreSdkVersion)/.version</DotnetSdkVersionFile>
|
|
</PropertyGroup>
|
|
|
|
<ReadLinesFromFile File="$(DotnetSdkVersionFile)" Condition="Exists('$(DotnetSdkVersionFile)')">
|
|
<Output TaskParameter="Lines" PropertyName="DotnetSdkVersionLines" />
|
|
</ReadLinesFromFile>
|
|
|
|
<PropertyGroup>
|
|
<MetaVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 0 ])</MetaVersion>
|
|
<MetaBuildTime>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 1 ])</MetaBuildTime>
|
|
<MetaBuild>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 2 ])</MetaBuild>
|
|
<MetaDotnetSdkVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 3 ])</MetaDotnetSdkVersion>
|
|
<MetaDotnetSdkVersion Condition="'$(DotnetSdkVersionLines)' != ''">$(NETCoreSdkVersion) (commit $([System.String]::Copy( $(DotnetSdkVersionLines) ).Split( ';' )[ 0 ].Substring( 0, 10 )))</MetaDotnetSdkVersion>
|
|
<MetaRustVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 5 ])</MetaRustVersion>
|
|
<MetaMudBlazorVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 6 ])</MetaMudBlazorVersion>
|
|
<MetaTauriVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 7 ])</MetaTauriVersion>
|
|
<MetaAppCommitHash>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 8 ])</MetaAppCommitHash>
|
|
|
|
<!--
|
|
The architecture is the one the app is built for. The build script and the pipeline pass it to
|
|
dotnet publish; in any other build, SelfContained makes the SDK pick the RID of this machine.
|
|
-->
|
|
<MetaArchitecture>$(RuntimeIdentifier)</MetaArchitecture>
|
|
|
|
<MetaPdfiumVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 9 ])</MetaPdfiumVersion>
|
|
<MetaVectorStoreVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 10 ])</MetaVectorStoreVersion>
|
|
|
|
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
|
|
|
<AssemblyVersion>$(MetaVersion)</AssemblyVersion>
|
|
<FileVersion>$(MetaVersion)</FileVersion>
|
|
<InformationalVersion>$(MetaVersion)</InformationalVersion>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<AssemblyAttribute Include="AIStudio.Tools.Metadata.MetaData">
|
|
<_Parameter1>$(MetaVersion)</_Parameter1>
|
|
<_Parameter2>$(MetaBuildTime)</_Parameter2>
|
|
<_Parameter3>$(MetaBuild)</_Parameter3>
|
|
<_Parameter3_TypeName>System.UInt32</_Parameter3_TypeName>
|
|
<_Parameter4>$(MetaDotnetSdkVersion)</_Parameter4>
|
|
<_Parameter5>$(MetaRustVersion)</_Parameter5>
|
|
<_Parameter6>$(MetaMudBlazorVersion)</_Parameter6>
|
|
<_Parameter7>$(MetaTauriVersion)</_Parameter7>
|
|
<_Parameter8>$(MetaAppCommitHash)</_Parameter8>
|
|
</AssemblyAttribute>
|
|
<AssemblyAttribute Include="AIStudio.Tools.Metadata.MetaDataArchitecture">
|
|
<_Parameter1>$(MetaArchitecture)</_Parameter1>
|
|
</AssemblyAttribute>
|
|
<AssemblyAttribute Include="AIStudio.Tools.Metadata.MetaDataLibraries">
|
|
<_Parameter1>$(MetaPdfiumVersion)</_Parameter1>
|
|
</AssemblyAttribute>
|
|
<AssemblyAttribute Include="AIStudio.Tools.Metadata.MetaDataVectorStore">
|
|
<_Parameter1>$(MetaVectorStoreVersion)</_Parameter1>
|
|
</AssemblyAttribute>
|
|
</ItemGroup>
|
|
|
|
</Target>
|
|
|
|
<!--
|
|
Since .NET 10, NuGet prunes a package whose assemblies ship with the shared framework, and with it the
|
|
package's build logic. Microsoft.Extensions.FileProviders.Embedded must not go this way, see its reference
|
|
above. .NET 10.0.0 already leaves it out of the pruning (dotnet/aspnetcore#63719); this target keeps it
|
|
even if a later version of .NET prunes it again. It is the workaround Microsoft gives in that issue.
|
|
-->
|
|
<Target Name="_PreserveFileProvidersEmbeddedPackageReference" AfterTargets="AddPrunePackageReferences">
|
|
<ItemGroup>
|
|
<PrunePackageReference Remove="Microsoft.Extensions.FileProviders.Embedded" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<!--
|
|
Scoped CSS (`.razor.css`) is bundled into `$(AssemblyName).styles.css`, which App.razor links.
|
|
That bundle is generated at build time, so it never lives in the source tree's wwwroot. The
|
|
release build, though, serves static files solely from the ManifestEmbeddedFileProvider (see
|
|
Program.cs), fed by the `wwwroot\**` EmbeddedResource above. Without this target the bundle is
|
|
therefore missing at runtime and every scoped rule is dropped without a word, while the debug
|
|
build keeps working through the static web assets. Hence: build the bundle, then embed it
|
|
before the manifest is written.
|
|
-->
|
|
<Target Name="EmbedScopedCssBundle" DependsOnTargets="GenerateScopedCssFiles" BeforeTargets="_CalculateEmbeddedFilesManifestInputs">
|
|
<PropertyGroup>
|
|
<ScopedCssBundleToEmbed>$(IntermediateOutputPath)scopedcss\bundle\$(AssemblyName).styles.css</ScopedCssBundleToEmbed>
|
|
</PropertyGroup>
|
|
|
|
<!--
|
|
Fail loudly instead of shipping a release without the bundle: a missing file here means the
|
|
SDK changed where it writes the bundle, and every scoped rule would silently vanish again.
|
|
-->
|
|
<Error Condition="!Exists('$(ScopedCssBundleToEmbed)')"
|
|
Text="The scoped CSS bundle was not found at '$(ScopedCssBundleToEmbed)'. Without it, the release build serves no scoped CSS at all. Check where the SDK writes the bundle and adjust the EmbedScopedCssBundle target." />
|
|
|
|
<ItemGroup>
|
|
<EmbeddedResource Include="$(ScopedCssBundleToEmbed)" Link="wwwroot\$(AssemblyName).styles.css" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<!--
|
|
`_framework/blazor.web.js` makes the UI interactive, and App.razor loads it. Up to .NET 9, the shared
|
|
framework served it. Since .NET 10, it is a static web asset of the package Microsoft.AspNetCore.App.Internal.Assets,
|
|
which names its folder in BlazorFrameworkStaticWebAssetRoot. Like the scoped CSS bundle above, the release
|
|
would therefore lack it: the window would show the app, but nothing in it would react. Hence: embed it
|
|
before the manifest is written.
|
|
-->
|
|
<Target Name="EmbedBlazorScript" BeforeTargets="_CalculateEmbeddedFilesManifestInputs">
|
|
<PropertyGroup>
|
|
<BlazorScriptToEmbed>$(BlazorFrameworkStaticWebAssetRoot)\blazor.web.js</BlazorScriptToEmbed>
|
|
</PropertyGroup>
|
|
|
|
<!--
|
|
Fail loudly instead of shipping a release without the script: a missing file here means the
|
|
package moved it, or the SDK no longer adds the package.
|
|
-->
|
|
<Error Condition="'$(BlazorFrameworkStaticWebAssetRoot)' == '' Or !Exists('$(BlazorScriptToEmbed)')"
|
|
Text="The script of Blazor was not found at '$(BlazorScriptToEmbed)'. Without it, the release starts with a window which does not react at all. Check where .NET keeps blazor.web.js and adjust the EmbedBlazorScript target." />
|
|
|
|
<ItemGroup>
|
|
<EmbeddedResource Include="$(BlazorScriptToEmbed)" Link="wwwroot\_framework\blazor.web.js" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
</Project>
|