Answered
How do i deploy js/css files with media libraries and apps?

should i use copy to output or what should i do?

Votes Newest

Answers 3


use the embedded resource mechanism. create a folder named resources and put your files there. add them to your project either by UI or by using this line (for each resource): <EmbeddedResource Include="resources/DrawRects.js" /> (Please note that for our resolution mechanism it is crucial to put resources into the resources folder for non framework assemblies, see https://github.com/aardvark-platform/aardvark.media/commit/c3945dbf7d8f9ba9c02696264c72dec1662e20c8)

in your suave server you now need to register the embedded resource by using: Reflection.assemblyWebPart assembly assembly here stands for the assembly the resource was actually embedded into. as convention use a dummy type: type EmbeddedResources = EmbeddedResources the registration now looks like: Reflection.assemblyWebPart typeof<EmbeddedResources>.Assembly

library consumers now need to rembember to register resources embedded into the library. since we have the EmbeddedResources type convention it is easy to adress a type within the library assembly in order to the the runtime assembly.

if you have a better idea, feel free to contribute (seealso the commit linked above)


Step-by-step Instructions:

  • In the dll which shall have the embedded file, create a "useless" Type named EmbeddedResources

  • copy the file to include into folder "resources" in your project folder. Add it to project. Set the resource type to EmbeddedResource

  • In the client program, which shall receive the served file, create a Reflection.assemblyWebPart of the "useless" type:

    let t = typeof<Aardvark.UI.Primitives.EmbeddedResources>
    WebPart.startServer 4321 [ 
        MutableApp.toWebPart' app.Runtime false instance
        Reflection.assemblyWebPart (t.Assembly)
    ]   
1
Posted 9 months ago

https://github.com/aardvark-platform/aardvark.docs/wiki/Deployment-of-WebResources

  
Posted 9 months ago