I have an big issue when publishing my application on another machine. The apps resources as pictures and sounds can't be found anywhere thou they actually are installed somewhere I really don't know where.. I'm talking about oneClick Deployment! I have put the files in separate folders in the Resource folder in the Solution explorer and the path is a string path inside Settings like this ....\Resources\Images\Cards\ and ....\Resources\Sounds\ Whatever I do the program can't find its resources so what is the basic issue here? I believe it's something wrong with the path because I see when the program gets installed it installs everything (same amount of MB). Any suggestions anybody? C# Visual Studio 2010 Black Jack Game
问题:
回答1:
I had the same problem, You can do the following:
- Open the .resx file
- Just above the file, there is a access modifier listbox. if it is set to "No code generated" , Select public from the list
Build,
Hopefully, problem solved.
回答2:
Well I found the answer to this issue after a while of struggling.. You have to erase the "..\..\" before the Resource folder in the "settings" while you are about to publish otherwise the deployed application can not find its resources thus they will not be at the same folder as described. But remember if you want to continue working on your project you must put back "..\..\" for debugging the program otherwise debugging will not work!!! I was not allowed to publish the image to show you here because of I don't have earned "10" reputations yet.. :)
回答3:
In Visual Studio 2010 professional open your project open the project properties select Web Under Servers set the Virtual Path as your deployed website virtual path.
If you set the virtual path to /BookStore You need to update all the resources references
Look like the following from
src="../../img/picture.png"
to
src="/BookStore/./img/picture.png"
回答4:
I had the same issue, I assume it is suppose to be that way with two different paths. This is what I did so I no longer had to edit the file paths when going from debugging to production.
Public RP As String = IO.Path.GetFullPath(My.Resources.ResourceManager.BaseName)
Public filePath As String = RunOrInstall(RP)
'Checks to see if debugging or installed and returns correct path
Private Function RunOrInstall(RP)
Dim pathing As String
If RP.ToString().IndexOf("bin") = -1 Then
pathing = RP.Substring(0, RP.LastIndexOf("\")) & "\Resources\"
Else
pathing = RP.Substring(0, RP.LastIndexOf("bin")) & "Resources\"
End If
Return pathing
End Function
回答5:
If I understand the problem correctly, I believe I had a similar issue...
I was creating an installer for one of my c# apps, and whenever I installed the program it couldn't find any of the resources it needed to run.
The problem ended up being that the files that the installer was putting on the desktop and in the programs menu weren't set to "shortcut". Try setting "Type" to "Shortcut" (I'm using microsoft visual studio 2008, and it requires a right-click -> create new shortcut -> select file to create a shortcut to... it may be different for whatever IDE you're using)
edit - I just noticed you put vs 2010 in your tag, so the process should be very similar