简体   繁体   English

VS2010基本Web应用程序以及扩展的应用程序和版本控制

[英]VS2010 base web application and extended application and version control

Currently I have one base webapplication, lets call it "Framework.Presentation". 目前,我有一个基本的Web应用程序,可以将其称为“ Framework.Presentation”。 This application contains all of the base items (default code and some default templates) of the web application. 此应用程序包含Web应用程序的所有基本项(默认代码和一些默认模板)。 For multiple customers, I want to extend this base application with client specific code and templates. 对于多个客户,我想使用客户端特定的代码和模板来扩展此基础应用程序。 The base application is a subversion repository, and for each client we want a different subversion repository. 基本应用程序是一个Subversion存储库,对于每个客户端,我们需要一个不同的Subversion存储库。

I had the following structure in mind: 我想到的是以下结构:

ClientProject
  - Framework
    - Framework.Presentation
  - ClientProject.Presentation

The "ClientProject" is a repository on it's own, with an External to my Framework repository. “ ClientProject”是一个独立的存储库,带有我的Framework外部存储库。 In my ClientProject.Presentation project, I'll link to the Framework.Presentation project. 在我的ClientProject.Presentation项目中,我将链接到Framework.Presentation项目。

This isn't a problem, however: 但是,这不是问题:

In the Framework.Presentation I have some templates in the App_Data folder, lets say: 在Framework.Presentation中,我在App_Data文件夹中有一些模板,可以这样说:

App_Data
  - Templates
    - Default
      - All the files here

In my ClientProject.Presentation I could add the same, without the folder 'Default'. 在我的ClientProject.Presentation中,可以添加相同的内容,但不包含“默认”文件夹。 The application will look first directly in the App_Data/Templates , and after it in App_Data/Templates/Default . 该应用程序将首先直接在App_Data/Templates查找,然后在App_Data/Templates/Default查找。

Also the Framework.Presentation has an '/Admin' folder, where users should be able to do some admin stuff of the web application. Framework.Presentation也有一个“ / Admin”文件夹,用户应该可以在其中执行Web应用程序的某些管理工作。

If I publish the ClientProject.Presentation, all the files fall in place. 如果我发布ClientProject.Presentation,则所有文件都放置在适当的位置。 However, if I want to debug the application in VS2010, the files of the Framework.Presentation aren't copied to the root folder of the ClientProject.Presentation project, so I can't debug all the functions. 但是,如果要在VS2010中调试应用程序,则不会将Framework.Presentation的文件复制到ClientProject.Presentation项目的根文件夹中,因此无法调试所有功能。 Also the application cant find his default templates. 应用程序也找不到他的默认模板。

In which way can I solve this? 我可以用什么方式解决这个问题?

OK, a potential solution is... 好的,潜在的解决方案是...

Using your file structure, you add the project ClientProject.Presentation to the solution. 使用文件结构,将项目ClientProject.Presentation添加到解决方案中。

You dont add the Framework.Presentation project. 添加Framework.Presentation项目。 Instead you add each file individually to your ClientProject.Presentation as a link file . 而是将每个文件作为链接文件分别添加到ClientProject.Presentation中。 ( Add -> Existing Item , select the file, click the down arrow on the add button, and select Add As Link ). Add -> Existing Item ,选择文件,单击添加按钮上的向下箭头,然后选择Add As Link )。

This will ensure that the files are still saved in the appropriate location in the file system, but the IDE will know where they live in the solution. 这将确保文件仍保存在文件系统中的适当位置,但是IDE将知道它们在解决方案中的位置。

The only drawback is this will be fairly tedious, depending on the size of your Framework.Presentation project. 唯一的缺点是,这将非常繁琐,具体取决于Framework.Presentation项目的大小。

You could possibly create a Framework.Presentation DLL that is referenced by your ClientProject.Presentation project. 您可以创建由ClientProject.Presentation项目引用的Framework.Presentation DLL。 You would need to configure your Framework files as embedded resources. 您将需要将Framework文件配置为嵌入式资源。 I haven't tried this, so I'm not sure how well it would work. 我没有尝试过,所以我不确定它的效果如何。

You could use the pre-build event as you suggested to copy all the files from the Framework.Presentation folders to the ClientProject.Presentation . 您可以按照建议使用预构建事件,以将所有文件从Framework.Presentation文件夹复制到ClientProject.Presentation However I suspect that this might get messy. 但是我怀疑这可能会变得混乱。 For example: 例如:

  • How do you handle filename clashes? 您如何处理文件名冲突?
  • Would you need to exclude the Framework.Presentation files in the ClientProject.Presentation folder so you don't accidentally commit them to subversion. 您是否需要在ClientProject.Presentation文件夹中排除Framework.Presentation文件,以便您不会将它们意外提交到Subversion。
  • Would you also need to automatically update the ClientProject.Presentation project to reference these files? 您是否还需要自动更新ClientProject.Presentation项目以引用这些文件? If not, how will they get built and debugged? 如果没有,将如何构建和调试它们? If so, how do you handle the project reload? 如果是这样,您如何处理项目重新加载?
  • How would you handle the extra files for clean builds, build server integration, deployment packages, etc. 您将如何处理用于干净构建,构建服务器集成,部署程序包等的额外文件。

Create a wrapper solution. 创建包装器解决方案。 In this you should have all of your projects. 在此您应该拥有所有项目。 Add a post build step to do all of the copying ect. 添加一个后构建步骤以执行所有复制操作。 You're not going to find a simple or clean solution to your problem. 您不会找到简单或干净的解决方案来解决您的问题。 If you're not well acquainted with MSBuild you will be soon. 如果您对MSBuild不太了解,很快就会知道。 It is certainly capable of doing everything you want, it's just going to be tedious. 它肯定有能力做您想要的一切,这将很乏味。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM