0

I have a simple class library that currently resides within SVN hosted locally. I'm working on an MVC project that resides within GIT hosted through bitbucket. The class library is a wrapper to a production web service that I need to reference in my MVC project. The class library is still being actively maintained and sees updates about once a month. I'm looking for the best way to incorporate or reference the class library into my MVC project without mucking up source control too badly. Here are the ideas I've come across online:

  • Build the class library from source, include the compiled DLL in my MVC project and monitor SVN checkins for this class library so I know when the DLL needs to be re-built.
  • Include the source for the class library as part of my MVC project's solution and have the class library built as part of the MVC project's MSBuild tasks.
  • I am not a GIT guru, but after reading the documentation a little bit, I do not believe a GIT Subtree would work in this case, as the external repository I am looking to reference is hosted in SVN, not git.
  • I also do not believe a GIT Submodule would be appropriate here either.

Is there an easy method of referencing this class library within my MVC project? If it helps, I do not feel I will ever be submitting changes for this class library back to SVN, I'll only be reading the repo, not performing checkins.

mckennawebdev
  • 547
  • 1
  • 5
  • 17

1 Answers1

0

After extensive research, I did the following:

Update my GitIgnore to block .svn

Checkout the SVN project to a subdirectory within the MVC Project Solution such as SolutionDir\SVNProjectDir

Within my MVC project's CSPROJ file, I added the following:

<Target Name="BeforeBuild">
  <Exec Command="svn update $(MSBuildProjectDirectory)\..\SVNProjectDir" />
</Target>

This forces the MVC project to fetch latest for the SVN project prior to building. The end result is that the code I need for this class library is included in our Git source control for all users.

It is important to note that the before build task will not stop the project from building if a user does not have an SVN client installed or has not properly set up the SVN directory within the project. This is acceptable in my team, but may not be acceptable for everyone.

mckennawebdev
  • 547
  • 1
  • 5
  • 17