I'm having a problem deploying a ClickOnce application. I'm using Visual Studio 2008. I have a referenced DLL file that is not being deployed.
In the project properties -> Publish tab -> Application Files
开发者_如何学CThe referenced DLL file does not appear, so I can't add it.
The DLL file is not used directly in my code- however it is used by another DLL file that I reference.
Is there a way I can manually edit something to ensure the DLL file is copied over?
It might be worth mentioning that the DLL file is a third-party DLL file from DevExpress: DevExpress.XtraPrinting.dll. I think it may be loaded as a plugin by one of the other DevExpress DLL files.
I know this problem rather well and there a few things to do to fix it:
- Add a reference to the DevExpress.XtraPrinting.dll dll in you project.
- In the references section set the DevExpress.XtraPrinting.dll to Copy Local = true (this seems to help VS remember the dll more)
To force VS to know that you need this dll you will need to use it. This can be done by instantiating an instance of ExportOptions or some similar object. e.g.
var options = new ExportOptions(); options.Html.Title = "some text";
Now make sure to forcefully set the Publish Status to "Include" in the ApplicationFiles section of the Publish tab.
That should solve your problem.
Thanks for the replies - however I found that manually editing the csproj file worked for me. For anyone else with this problem you may need to add your dll that you want deployed like this:
<PublishFile Include="DevExpress.XtraPrinting.v9.3">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
Also ensure you have this in your references section:
<Reference Include="DevExpress.XtraPrinting.v9.3, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\SomePath\DevExpress.XtraPrinting.v9.3.dll</HintPath>
</Reference>
I'd also like to point out that RobinDotNet's solution also works.
Add the third-party DLL file to your project (right-click on project, add existing item...). Set 'Build action' to 'None' and set 'Copy to Output Directory' to 'Do not copy'.
Delete your reference to that DLL file. Re-add the reference, and browse to that DLL file in your project and select it.
On the reference, set 'Copy Local' to 'True'.
Now it should show up in application files, because your code references a local copy, and it is set to deploy it.
Note that this doesn't work for all assemblies; some just MUST be installed in the GAC. But it's free to try. If it has to be in the GAC, it will tell you when you try to install it.
精彩评论