Reputation: 2227
I have an xml license file that needs to be deployed in the same directory as the assembly that references it is located.
I had assumed the BIN folder was the correct location. However what is happening is that ASP.Net is copying the assembly to a folder similar to C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\swsscriptstest\ef2666d0\23e85c28\assembly\dl3\9353205e\6605f3df_cd85cb01. Once IIS cleans up after itself, these files are deleted.
Since it's an XML and not an assembly file, I could not use to the config.
I have also tried to add the file as an "embedded resource" with no luck.
Can anyone offer any advice?
Thank you!
Upvotes: 0
Views: 1622
Reputation: 88072
Are you the publisher?
If so, then it sounds like you've code things completely wrong.
If it's config info, it belongs in the config file this way any app developer can deal with it on a normal level.
If it's not, then put it in the app_data folder. That is a special folder designed for this purpose.
Point is, you cannot know where the assembly is executing from. It might be gac'd, in the bin folder, or optimized into some other directory.
Another option:
If the assembly you have has an installer, run that on the web server. This will most likely copy the assembly to the GAC along with the appropriate license file.
If it doesn't have an installer, try placing the assembly in the GAC. Then figure out where windows actually stored it and copy the license file there.
Upvotes: -1
Reputation: 6302
You need to add the XML into your solution and set the Copy to Output Directory to Copy always.
Upvotes: 2
Reputation: 43087
What are you doing with the xml file? If you're reading/writing to it in your app, the best place to put it is in ~/App_Data. You can get the full path at runtime by using Server.MapPath("~/App_Data/nameOfYourXmlFile.xml")
.
http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx
Upvotes: 0