开发者

How to avoid file duplication in Visual Studio project when dealing with path issue?

开发者 https://www.devze.com 2023-03-23 18:55 出处:网络
Our vendor-created platform is asp.net based and I am developing customizations in the form of web user controls (ascx) that the product will host.

Our vendor-created platform is asp.net based and I am developing customizations in the form of web user controls (ascx) that the product will host.

I have the web portion of this web product on my dev pc and it looks something like this generic representation:

C:\Inetpub\wwwroot\VendorApp\WebParts\ServiceModule  [ascx files here]
C:\Inetpub\wwwroot\VendorApp\WebParts\ServiceModule\Scripts [js files here]
C:\Inetpub\wwwroot\VendorApp\WebParts\ServiceModule\StyleSheets[css files here]

I decided to create my VS 2010 project like this:

C:\Inetpub\wwwroot\VendorApp\WebParts\CustomControls.sln
C:\Inetpub\wwwroot\VendorApp\WebParts\ServiceModule\CustomControls.csproj
C:\Inetpub\wwwroot\Vend开发者_如何转开发orApp\WebParts\ServiceModule\ [custom ascx and code behind]

I created it as a web application so that VS plays nice with ascx designer/intellisense although I deleted web.config etc since I actually test and debug through the vendor's site in IIS

This works reasonably well however I must reference js and css relative to this path:

<script type="text/javascript" src="WebParts/ServiceModule/Scripts/jquery-1.6.2.min.js"></script>

The problem is that VS complains that the path is invalid and refuses to allow jquery intellisense.

My current fix is to create sub folders below the project to mimic the path the VS is seeing. Jquery intellisense works and VS stops complaining. The downside is file duplication:

C:\Inetpub\wwwroot\VendorApp\WebParts\ServiceModule\WebParts\ServiceModule\Scripts\ [copy of any js I use]
C:\Inetpub\wwwroot\VendorApp\WebParts\ServiceModule\WebParts\ServiceModule\StyleSheets\ [copy of any css I use]

Is there a better way to solve this problem? It isn't a huge deal since only one copy of the scripts/css will actually deploy to production but this is still seems untidy from project/TFS point of view.

I've looked into the jquery vsdoc files but I don't think I need them since intellisense works perfectly as long as VS thinks the path is correct. I also considered sym links but I am on XP at least until later this year.


I didn't find a way to avoid the duplication, but I realized that I can make it a bit more tolerable by adding a post build event to robocopy to the other location.

0

精彩评论

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