Reputation: 7493
I have a solution in Visual Studio 2013 where I use xcopy in the post build events to copy necessary files into the bin\Debug
folder. The post build event works perfectly and when I run the application in visual studio the application can find the necessary files that are copied to the bin\Debug
folder.
xcopy "$(SolutionDir)packages\NUnit.Runners.2.6.3\*.*" "$(OutDir)..\..\NUnitRunners\" /E /I /Y /F
xcopy "$(SolutionDir)ProductionSmoke\bin\Debug\ProductionSmoke.exe" "$(OutDir)..\..\" /E /I /Y /F
xcopy "$(SolutionDir)ProductionSmoke\bin\Debug\ProductionSmoke.exe.config" "$(OutDir)..\..\" /E /I /Y /F
However, when I publish the solution using ClickOnce the application throws an exception that it cannot find the files.
private void buttonProductionSmoke_Click(object sender, EventArgs e)
{
var pathToNunitGui = AppDomain.CurrentDomain.BaseDirectory + "NUnitRunners\\tools\\nunit.exe";
var pathToProductionSmoke = AppDomain.CurrentDomain.BaseDirectory + "ProductionSmoke.exe";
Process.Start(pathToNunitGui, pathToProductionSmoke);
}
I looked in the User\AppData\
folder and don't see the bin\Release
folder anywhere.
How do I supply the program a path to the files so they can be accessed after using ClickOnce deployment?
Upvotes: 0
Views: 1946
Reputation: 180
There's going to be an "app.publish" directory underneath the the specific configuration folder. This folder will contain a ".application" file, and an "Application Files" folder. Inside the "Application Files" folder, you will find version-specific folders with the primary and dependent binaries.
The version number for the folders will depend on the AssemblyInfo.cs file's AssemblyVersion. You should look into Continuous Integration, MSBuild, NAnt, etc to dynamically update this file to reflect the correct version.
Upvotes: 1