Error building project when referencing native assembly dependency in app.manifest
If you're using an app.manifest, and defining assembly dependencies (i.e. for SxS / Side by side / Reg-free COM etc), you may encounter this error when you build the project:
Could not find file 'AssemblyName, Version=x.x.x.x, PublicKeyToken=xxxxxxxxxxx, ProcessorArchitecture=x86, Type=win32'.
This is even when the native assembly is in place where the project can find it.
app.manifest may contain this fragment:
<dependency> <dependentAssembly> <assemblyIdentity name="Native.Custom" version="220.127.116.11" processorArchitecture="x86" type="win32" publicKeyToken="12345678"/> </dependentAssembly> </dependency>
This manifest is available to the project, with the manifest file in the project directory or in a subdirectory called
In this case, I have a sub directory called
Native.Custom, which contains my
The problem may be because the ClickOnce manifests are being generated.
- Open your project file in a text editor (or right click it in Visual Studio and choose
- Find the
GenerateManifestselement and set it to false:
- Save the project and reload it.
Now you should hopefully be able to build.