3

I have a C# project that represents an assembly that is going to be deployed to GAC. Therefore I want to generate a policy library for this assembly.

Currently I am doing it by using AL target inside AfterBuild or AfterCompile:

<PropertyGroup>
  <PolicyDllName>$(TargetDir)$(TargetName).policy.dll</PolicyDllName>
  <PolicyConfigName>$(ProjectDir)\policy.config</PolicyConfigName>
</PropertyGroup>

<AL LinkResources="$(PolicyConfigName)" 
    Platform="$(Platform)" 
    KeyFile="$(ProjectDir)MyKey.snk" 
    OutputAssembly="$(PolicyDllName)" 
    Version="%(AssemblyInfo.Version)">
  <Output TaskParameter="OutputAssembly" ItemName="FileWrites"/>
</AL>

It works fine and my policy assembly is generated.

However, although is generated in the output folder it is not a part of the project's output. For example, when I reference my project from another project, the DLL is copied into the second project's bin folder, but the policy assembly is not.

So it my policy assembly is just a file that was dropped to the project output folder and is not considered by MSBuild as a part of a project output.

Another example: when I reference my project from, say, a web project and then do Publish, the policy assembly is not included in a published web site while the project "main" assembly is.

the question is: what would be the way to make this "extra assembly" (or any extra file to that matter) a part of project's output?

Devolus
  • 21,661
  • 13
  • 66
  • 113
Alexey Raga
  • 7,457
  • 1
  • 31
  • 40

0 Answers0