It's possible to manually edit shared project to set build action for resource dictionary.
Shared project consists of Project.shproj
and Project.projitems
files, open second and locate dictionary there:
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)Dictionary.xaml" />
</ItemGroup>
Add after that
<ItemGroup>
<Page Include="$(MSBuildThisFileDirectory)Dictionary.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
it's a copy/paste thing from normal csproj
for WPF project containing dictionary.
Seems to work, though this build action is not visible when project is loaded into Visual Studio. Adding files to shared project doesn't affect this manual change.
Now I can have shared project containing resource dictionary, yay!
Resource dictionary can be merged into application dictionaries like if it's located in the root of the project (to use as static/dynamic resource in xaml designer):
<Application.Resources>
<ResourceDictionary >
<ResourceDictionary.MergedDictionaries>
<!-- doesn't really exists in project -->
<ResourceDictionary Source="Dictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
and/or loaded manually, e.g. using this pack Uri :
var dictionary = new ResourceDictionary()
{
Source = new Uri("pack://application:,,,/FlexProperty.xaml"),
};