开发者

Project References in Custom VS Project Template

开发者 https://www.devze.com 2023-03-17 00:59 出处:网络
I am working on creating a custom Visual Studio template for multiple project types.I would like to be able to add reference across the projects in the solution.e.g. MVVM solution where View, Model an

I am working on creating a custom Visual Studio template for multiple project types. I would like to be able to add reference across the projects in the solution. e.g. MVVM solution where View, Model and ViewModels are each in their own projects. I'd like to have the View have reference to the ViewModel project and the ViewModel project to have reference to the Model project.

Only documentation I can find on MSDN calls for strongly named assemblies to be referenced. http://msdn.microsoft.com/en-us/library/ms185290.aspx

I am able to get partially there, by modifying the .cproj file using some of system parameters, but this is heavily dependent on naming conventions etc. for instance I can have the Model project referenced in the ViewModel project because the concatenation of the $safeprojectname$ and "Model" makes the correct assembly name. But I cant get reference of the VM in the V, nor can I add any references to any testing projects.

    <ItemGroup>
        <ProjectReference Include="..\$safeprojectname$Model\$safeprojectname$Model.csproj">
         开发者_如何学Go <Project>{30C01E8B-96AE-45B4-A7B5-8F7BDCA4BDAB}</Project>
          <Name>$safeprojectname$Model</Name>
        </ProjectReference>
      </ItemGroup>

Does anyone know how I can go about achieving this in the template?

Thanks.


I dont know if this is the correct way to do this, but this is what I did. I ended up opening the config file in a text editor and replacing/adding the appropriate project references as necessary. By using appropriate naming conventions I was able to programatically create the project files, sub folders etc.

0

精彩评论

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

关注公众号