vb.net 为什么项目无法找到就在其鼻子下方的文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18392364/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why is the project unable to find a file that is right beneath its nose?
提问by B. Clay Shannon
I'm trying to build a solution that has three VB projects; one that I'm working on, and two others that have interdependencies (although one says "unavailable").
我正在尝试构建一个包含三个 VB 项目的解决方案;一种是我正在研究的,另一种是相互依赖的(尽管其中一种说“不可用”)。
In trying to compile, I get regarding the ancillary project, "Unable to find source file 'J:\DSDPAGE_T.xsl' for file 'DSDPAGE_T.xsl', located in '[TARGETDIR]', the file may be absent or locked."
在尝试编译时,我得到关于辅助项目的信息,“无法找到位于 '[TARGETDIR]' 中的文件 'DSDPAGE_T.xsl' 的源文件 'J:\DSDPAGE_T.xsl',该文件可能不存在或被锁定。 ”
J? I searched the solution to see if "J:" is hardcoded anywhere, and it's not, so...?!?
杰?我搜索了解决方案以查看“J:”是否在任何地方进行了硬编码,但事实并非如此,所以......?!?
The "missing" files are right there n the project! Why is it looking in J? If that is hardcoded somewhere, why doesn't 2-clicking the err msg take me to the spot? When I do, a "File System " tab appears with two panes. On the left:
“丢失”的文件就在项目中!为什么它在 J 中寻找?如果那是在某处硬编码,为什么 2 单击 err msg 不把我带到现场?当我这样做时,会出现一个带有两个窗格的“文件系统”选项卡。在左边:
File System on Target Machine
Application Folder
System Folder
User's Desktop
User's Programs Menu
...and on the right pane, a listing of the files in that project (the same ones I see in Solution Explorer), many of whom are the subject of err msgs that they cannot be found...?!?
...在右侧窗格中,列出了该项目中的文件(与我在解决方案资源管理器中看到的相同),其中许多是无法找到的错误消息的主题......?!?
Is this a "VB thing" (I've never worked with VB before) or...?!?
这是“VB 的东西”(我以前从未使用过 VB)还是......?!?
Maybe I can create a J drive and put those files the compiler is wearing blinders about in there just so it will compile - it's not that project I need to work on anyway, I just need to let the solution compile, so I can update the other project.
也许我可以创建一个 J 驱动器并将编译器蒙住的那些文件放在那里,这样它就可以编译 - 无论如何,这不是我需要处理的项目,我只需要让解决方案编译,这样我就可以更新其他项目。
UPDATE
更新
Looking at one of these files that is visible in the project, but for which the project exhibits acute myopia, its "SourcePath" property does say "J:\DSDPAGE_T.xsl" but that property is readonly/grayed out.
查看项目中可见的这些文件之一,但该项目表现出急性近视,其“SourcePath”属性确实显示“J:\DSDPAGE_T.xsl”,但该属性为只读/灰显。
UPDATE 2
更新 2
In response to user2701753:
回复 user2701753:
I know what you're talking about; I'm used to having these in C# projects; but in this case, there are no References folders. There is only:
我知道你在说什么;我习惯在 C# 项目中使用这些;但在这种情况下,没有 References 文件夹。只有:
Solution 'HDP' (2 projects)
HDP [project#1]
ReportFormats [folder]
[a bunch of .xsl files]
[a bunch of .vb files]
HDPSetup [project#2] <-- the problem child
DetectedDependencies [folder]
[various files: .dll, .xsl, .exe, .chi, .chm, .mdb, .bmp, .ico]
The "Detected Dependencies" folder (which I thought was maybe the VB version of References) is apparently empty - 2-clicking it does nothing; it doesn't expand or open up.
“Detected Dependencies”文件夹(我认为可能是 VB 版本的 References)显然是空的 - 双击它没有任何作用;它不会扩展或打开。
UPDATE 3
更新 3
Here is perhaps a good clue: When I look at the project files in Windows Explorer, many of the files that display in Visual Studio are not seen there! For example, C:\Project\ccr\Handheld\Development\Development\HDP\HDP\HDPSetup only has this:
这可能是一个很好的线索:当我在 Windows 资源管理器中查看项目文件时,在 Visual Studio 中显示的许多文件都没有在那里看到!例如,C:\Project\ccr\Handheld\Development\Development\HDP\HDP\HDPSetup 只有这个:
Debug [folder] <- empty
Release [folder] <- empty
HDPSetup.vdproj
HDPSetup.vdproj.vspscc
ccr.bmp
ccr.ico
According to VS, I would expect to see those files that it complains about being on the (nonexistent) J: drive.
根据 VS,我希望看到那些抱怨在(不存在的)J: 驱动器上的文件。
UPDATE 4
更新 4
This is related to the issue above.
这与上面的问题有关。
To recap the gist: I am trying to port/upgrade a VB.NET (.NET2/VS 2003) solution to .NET4/VS2010.
概括一下要点:我正在尝试将 VB.NET (.NET2/VS 2003) 解决方案移植/升级到 .NET4/VS2010。
The solution is comprised of three projects; the Setup project was wreaking more mayhem and malevolence than a marauding crash of rhinoceropuses (it was thought to be on drive J, apparently), and I don't need to do anything to that project, so I removed it from the solution.
该解决方案由三个项目组成;安装项目比犀牛的掠夺性崩溃造成了更多的混乱和恶意(它被认为是在驱动器 J 上,显然),我不需要对该项目做任何事情,所以我从解决方案中删除了它。
That removal reduced my error count from 35 to 14.
删除后我的错误计数从 35 减少到 14。
However, the remaining errs seem related to the "other" project. There are now two; I'll call them HDP and HHTConvert (because those are their names, and my current employer doesn't seem to be as paranoid about divulging any info that would identify the company or project as my previous one was).
但是,其余的错误似乎与“其他”项目有关。现在有两个;我会称他们为 HDP 和 HHTConvert(因为这是他们的名字,而且我现在的雇主似乎不像我以前的雇主那样害怕泄露任何可以识别公司或项目的信息)。
Although the Project Dependencies allows me to set one as dependent on the other, no matter which way I set it, it fails:
尽管 Project Dependencies 允许我将一个设置为依赖于另一个,但无论我以哪种方式设置它,它都会失败:
0) Both depending on each other - disallowed, circular jerk tailchasing considered bad juju
1) HDP depending on HHTConvert: Type 'HHTConvert.HHTConverter' is not defined.
2) HHTConvert depending on HDP: ""
3) Neither depending on the other:""
So it doesn't matter what I do, the same err msg appears. The line the err points to is:
所以不管我做什么,都会出现相同的 err msg。错误指向的行是:
Public hhtConvertThread As HHTConvert.HHTConverter
What do I have to do to introduce the HHTConvert project to the HDP project? It would seem them being in the same solution - especially when one "depends" on the other - would be enough. HHTConverter is apparently not very dependable.
将HHTConvert项目引入HDP项目需要做什么?看起来他们在同一个解决方案中——尤其是当一个“依赖”另一个时——就足够了。HHTConverter 显然不是很可靠。
UPDATE 5
更新 5
Correction/amendment to my original statement: "I'm trying to build a solution that has three VB projects"
更正/修正我的原始声明:“我正在尝试构建一个包含三个 VB 项目的解决方案”
Actually, I successfully removed one project, so it is two projects, and one is C# (the "main" one, HDP, is VB).
实际上,我成功删除了一个项目,所以它是两个项目,一个是C#(“主要”一个,HDP,是VB)。
Could that (the C#/VB "mismatch) cause the two projects to look askance upon each other, akin to the renowned Star-bellied Sneeches and the "plain vanilla" Sneeches? (I consider the plain ones to correspond to VB).
难道(C#/VB“不匹配”)会导致这两个项目互相怀疑,类似于著名的 Star-bellied Sneeches 和“普通的香草”Sneeches?(我认为普通的与 VB 相对应)。
UPDATE 6
更新 6
So I've got it compiling now (see my answers), but I'm getting a subsequent (runtime) error, namley: "Unable to load DLL 'cdbmenu1.dll': The specified module could not be found."
所以我现在已经编译(见我的答案),但我得到了一个后续(运行时)错误,namley:“无法加载 DLL 'cdbmenu1.dll':找不到指定的模块。”
And sure enough, one of the VB files does references a DLL with that rather bland name several times, with lines such as:
果然,其中一个 VB 文件确实多次引用了一个名称相当平淡的 DLL,包括以下几行:
Declare Sub GetLastMenu1Error Lib "cdbmenu1.dll" (ByVal Msg As String, ByVal Length As Int32)
So, I searched the local (work) network and found some copies of that DLL. I copied the newest version (2.5 years old) to HDP's bin folder, and tried to run the app. Now I get, "An attempt was made to load a program with an incorrect format"
因此,我搜索了本地(工作)网络并找到了该 DLL 的一些副本。我将最新版本(2.5 岁)复制到 HDP 的 bin 文件夹,并尝试运行该应用程序。现在我得到,“试图加载格式不正确的程序”
Is this the part of the story known as "DLL Purgatory" or a rendition of "DLL Perdition" (geschweige denn "Extraordinary DLL Rendition")?
这是故事中被称为“DLL 炼狱”的部分还是“DLL Perdition”的演绎(geschweige denn“Extraordinary DLL Rendition”)?
回答by tolanj
Look at the 'References' in the projects in the Solution Explorer, these have a 'Full Path' if that's wrong drop the reference and readd it.
查看解决方案资源管理器中项目中的“参考”,如果错误删除参考并阅读它,则它们具有“完整路径”。
回答by Isaiah4110
In the visual studio setup project have you added "active content" from VB project? Open your VB project file in a notepad, check the different files included in your project file, your setup project will try to include all those files as a part of your MSI. So open the project file and you should see the J drive there.
在 Visual Studio 设置项目中,您是否从 VB 项目中添加了“活动内容”?在记事本中打开 VB 项目文件,检查项目文件中包含的不同文件,您的安装项目将尝试将所有这些文件作为 MSI 的一部分包含在内。因此,打开项目文件,您应该会在那里看到 J 驱动器。
All those files can be taken out from the project and then re added.
所有这些文件都可以从项目中取出,然后重新添加。
回答by B. Clay Shannon
I solved it: I had to add the .DLL from the C# project to the VB project's References. Once I did so, all errors disappeared. Why that wasn't already there, I have no clue.
我解决了这个问题:我必须将 C# 项目中的 .DLL 添加到 VB 项目的引用中。一旦我这样做了,所有错误都消失了。为什么它不在那里,我不知道。

