Wednesday, January 16, 2008

Text File does not get deployed from Class Library Project into Asp.NET Web Application

The issue sounds simple to me:

Text File does not get deployed from Class Library Project into Asp.NET Web Application

"We have a webproject and would like to deploy HTML and
Text Templates from a common Project into the web project
output folder.

The Attributes on the text / html files are set like this:
Build Action: Content
Copy to Output Directory: Copy Always
it just copy the files into the common csharp project under the bin/debug
but it doesn't appears within the web project.

any idea how to solve this issue without a lot of post build scripts?"

This have been posted 2 days ago I posted the following problem at:
http://forums.asp.net/t/1205184.aspx

To fix this issue you simply need to think in different direction - the oposite one :-)

Step 1: Don't add your files you would like to share in TFS (Team Foundation Server) into your Class Library Project - add files (html / xml / text / etc.) into your App_Data folder in your Asp.NET Web Application Project Type.
Step 2: Create your Folder within your Class Library Project you like to have the files. Once you have created the folder, you can right click on the folder and select : Add -> Existing Item

This will open you a dialog folder with a small HINT which is the BIG SHOOT for this issues. Don't simply add it while you press "Add" you need to select the small arrow near the Button and select "Add As Link" like the below printscreen shows:















Once you have done above steps, select your file and look at the file properties within your Visiual Studio. There you find some Attributes you need to check, you should check that the "Build Action:" is equal to "Content" and the "Copy to Output Directory:" is set to "Copy Always" or "Copy if newer".

In my case I do not need now to held the files redunded and sync them upon changes ....


just think different you will solve the problem!! was the motto upon this issue !

2 comments:

Anonymous said...

Nice..

could you plz write it the way, I can understand how to solve this issue?

i've a lib-project and a website. in the lib-proj i've got some xml to include into the website on publish..

thx

Roni said...

i have updated the text, i hope its more clearly now.

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge