Non-web projects
A console app, or a NativeAOT binary that serves its own UI, has no static web assets. Embed the output in the assembly instead.
<PropertyGroup>
<PareEmbed>true</PareEmbed>
<PareEmbedPrefix>ui/</PareEmbedPrefix>
<EnablePareDefaultItems>false</EnablePareDefaultItems>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Extrode.Pare.Build" Version="0.6.2" PrivateAssets="all" />
<TypeScriptSource Include="web/**/*.ts" />
</ItemGroup>
web/lib/util.ts is written to obj/<configuration>/<tfm>/pare/web/lib/util.js, never into the
source tree, and embedded as ui/web/lib/util.js. Read it back:
using var stream = typeof(Program).Assembly.GetManifestResourceStream("ui/web/lib/util.js");
- The resource name is the prefix plus the path below the project.
PareServeAtchanges the path:<TypeScriptSource Include="web/**/*.ts" PareServeAt="/" />givesui/lib/util.js. - The outputs are not
Content, not static web assets, and not copied to the build or publish output. - A name such as
strings.de.tsstays in the main assembly (no satellite assembly forde). - The step is incremental: a
.tsedit rewrites its.jsand recompiles; a deleted.tsdrops its resource and its.json the next build.
Do it your own way
To embed or copy the files differently, leave PareEmbed off and use the @(PareOutput) item:
<PropertyGroup>
<PareOutDir>$(BaseIntermediateOutputPath)pare/</PareOutDir>
</PropertyGroup>
<Target Name="EmbedPare" AfterTargets="PareStripTypeScript">
<ItemGroup>
<EmbeddedResource Include="@(PareOutput)" LogicalName="ui/%(PareOutput.PareRelativePath)" />
</ItemGroup>
</Target>
$(IntermediateOutputPath) is still empty where a project file sets its properties, so
PareOutDir cannot use it. $(BaseIntermediateOutputPath) (obj/) is set by then.
After PareStripTypeScript, @(PareOutput) lists every output. %(PareSource) is the source's
full path. %(PareRelativePath) uses /: the URL path for a static web asset (js/app.js), the
resource name without the prefix under PareEmbed, and otherwise the output's path below the
project (or below PareOutDir). A target with AfterTargets="PareStripTypeScript" sees it on
every build, including builds that skip the strip as up to date.