想要在部署期间使用我的Visual Basic项目分发PDF文件 [英] Want to Distribute PDF file with my Visual Basic Project during Deploying

查看:85
本文介绍了想要在部署期间使用我的Visual Basic项目分发PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Visual Basic(Visual Studio专业版,.NetFrameWork 4.0) 我想在我的Button_Click_Even t中包含并调用PDF 我在Resources中包含MyPDF.pdf,然后单击链接,并调用为:

I have Visual Basic (Visual Studio Professional Edition, .NetFrameWork 4.0) I want to include and Call PDF with my Button_Click_Event I include MyPDF.pdf in Resources and after that I follow the link and call as:

Process.Start("LinkTo \ MyPDF.pdf")

Process.Start("LinkTo\MyPDF.pdf")

但是可以,并且可以在我自己的PC上正常运行,但是当我将其安装在另一台PC上时(或者我按指定的链接放置PDF放置),因此它无法打开MyPDF.pdf

but this is Ok and works, as this in my own PC, but when I install this in another PC (or I displace the PDF from the link as specified) so it fails to open the MyPDF.pdf

所以我的问题以及我在安装过程中所做的工作MyPDF.pdf也在用户计算机上安装了,我为此使用了哪些代码?

So My Question as What I did that during installation also MyPDF.pdf also install on user computer and which code I use for this?

先谢谢您了:)

推荐答案

首先,在解决方案资源管理器中按pdf文件.该文件的属性应如下:

Firstly, press on the pdf file in the solutions explorer. Propeties of the file should be as following:

Build Action: Content 
Copy to output directory: Copy always

用户计算机中文件的路径为Application.StartupPath & "\Resources\MyPDF.pdf"

The path to the file in users computer will be Application.StartupPath & "\Resources\MyPDF.pdf"

不确定我没有忘记什么,所以告诉我是否可行:)

Not sure I did not forget something, so tell me if it works :)

我看到很多人对此有麻烦,所以这是我知道在Visual Studio中将文件与.net程序一起部署的最简单方法:

I see a lot of people are having trouble with this so here is the simplest way I know to deploy a file together with .net program in visual studio:

  1. 将文件拖放到解决方案资源管理器中
  2. 在解决方案资源管理器中按文件,然后将其属性修改为:
  1. Drag and drop the file to the solutions explorer
  2. Press on the file in the solutions explorer and modify it's propeties to:

构建操作:内容;
复制到输出目录:始终复制

  • 要在代码中使用的文件的路径为Application.StartupPath & "\filename.txt"
  • Build Action: Content;
    Copy to output directory: Copy always

  • The path to the file to be used in code will be Application.StartupPath & "\filename.txt"
  • 我认为有一种方法可以不用Application.StartupPath来完成,这可能会以某种方式引起问题,但是我不知道如何

    I think there is a way to do it without Application.StartupPath, which may cause problems somehow, but i don't know how

    这篇关于想要在部署期间使用我的Visual Basic项目分发PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆