开发者

Error when adding .css and other resource files to multiple Visual Studio projects

I'm trying to set up a solution in Visual studio that includes multiple web application projects, and I'd like to share .css file开发者_如何学Cs, master pages and other resources among the projects. I created a project to house the resources, then made links to the files within my web application project as instructed by the MSDN documenation, using "Add as link."

When I debug the project, I get the following error: "Copying file Site.css to obj\Debug\Package\PackageTmp\Site.css failed. Could not find file 'Site.css'."

What am I missing? Is there a special Build Action that I have to set? I've done this successfully with .cs files before, so I'm not sure how this is different.

Edit: OK, I have partially figured out the issue. Apparently the linked files are included when I use Visual Studio's publish function to push the project to our development server. However, Visual Studio is not copying the file correctly when I hit F5 and run the project in the debugging server. Not sure why...


I faced a similar issue in VS 2005 (which may or may not work the same way as 2010) with a shared CSS file that in my project was added as a link. Running within the IDE wouldn't copy it to the correct directory.

With thanks to a tip on this page, I added the following post-build event command line (on successful build) which appears to have done the trick:

copy $(SolutionDir)\common*.css $(ProjectDir)\common\

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜