简体   繁体   English

C#Visual Studio 2010 Ultimate在ClickOnce部署中包含html文件

[英]C# Visual Studio 2010 ultimate include html files in ClickOnce Deployment

I have a C# program created in VS 2010 ultimate. 我有一个在VS 2010 Ultimate中创建的C#程序。 I have added .html files to be used as help files. 我添加了.html文件用作帮助文件。 The help files are in a directory in the same directory as the project file. 帮助文件与项目文件位于同一目录中。 Does anyone know what the path would be from current directory after deployment with ClickOnce? 有谁知道使用ClickOnce部署后当前目录的路径是什么? Nothing I have tried has worked. 我尝试过的一切都没有奏效。 I have also put the .html files in the same directory as project file but that doesn't work either. 我也将.html文件与项目文件放在同一目录中,但这也不起作用。 (I have added the .html files in project properties) (我已经在项目属性中添加了.html文件)

In the Solution Explorer, right click on your x.html file and select Properties . 在解决方案资源管理器中,右键单击x.html文件,然后选择Properties In the properties set Copy to Output Directory setting to Copy always . 在属性中,将“ Copy to Output Directory设置为Copy always

In your code reference your x.html file using this code: 在您的代码中,使用以下代码引用您的x.html文件:

var directoryPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
var filePath = Path.Combine(directoryPath, "x.html");

Have you tried adding the .HTML files to your project itself? 您是否尝试过将.HTML文件添加到项目本身? Then, inside the project set 'Copy To Output Directory' to True ? 然后,在项目内部将“复制到输出目录”设置为True

Go to the properties of the files and make sure Copy to Output is true . 转到文件的属性,并确保“ Copy to Outputtrue And then, you should be able to access them like this: 然后,您应该能够像这样访问它们:

string path = string.Format(@"{0}\{1}", Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Path\To\The\File.txt");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Visual Studio、C# 项目的部署中包含文件和文件夹? - How to include files and folders in the deployment of a visual studio, C# project? 使用先决条件在Visual Studio 2010中创建C#winApp的安装和部署 - Creating Setup & Deployment of C# winApp in Visual Studio 2010 with Prerequisites c# Visual Studio Ultimate 2013 asp.net 网站发布部署 - c# visual studio ultimate 2013 asp.net website release deployment Visual Studio ClickOnce部署是否自动包含必要的.NET框架? - Does Visual Studio ClickOnce deployment automatically include the necessary .NET framework? Visual Studio / C#:包含/合并文件 - Visual Studio/C#: Include/merge files 使用Visual Studio 2010 Ultimate进行模拟 - Mocks with Visual Studio 2010 Ultimate 如何使用ClickOnce部署我的C#(4.0)Visual Studio 2010基于Windows窗体的应用程序? - How to use ClickOnce to deploy my C#(4.0)Visual studio 2010 windows form based Application? 如何在Visual Studio 2010(最终版)中部署C#.net项目? - How to Deploy a C#.net project in Visual studio 2010 (ultimate)? exe中的Visual Studio 2010包含文件 - Visual Studio 2010 include files in the exe c#clickonce部署:如何重命名“应用程序文件”? - c# clickonce deployment: how to rename 'Application Files'?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM