Skip to content

Ease deployment of LibGit2Sharp based web sites #597 #700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed

Ease deployment of LibGit2Sharp based web sites #597 #700

wants to merge 15 commits into from

Conversation

sitereactor
Copy link
Contributor

This PR adds a targets file, which is used as part of the nuget package (nuspec) to ensure that NativeBinaries are copied/moved to the bin folder of the output directory.
As mentioned in #597 there is one caveat of this targets build file, and that is that the NativeBinaries folder is copied to the root of the csproj folder and not removed after having been copied to the output directory, which could be another project.

If the csproj is a web application the NativeBinaries folder will be included in the bin folder when doing a Publish from Visual Studio, but again a minor quirk that the NativeBinaries folder is also included in the root. And this is only if the nuget is installed in the web application. If its installed in another project it won't work because its not hooking into the publishing pipeline (reason below).

It was not possible to include Publish/WebDeploy specific pipeline modifications to remove the folder in the root, as the nuget then failed to install under a standard class library (if no web application was present in the solution). I assume this is because a web application includes additional targets for the Publish/WebDeploy pipeline, which a class library project doesn't.

…included upon building.

The updated nuspec file removes the old powershell scripts and uses the build target instead.
@sitereactor
Copy link
Contributor Author

Another thing to consider is whether it would be desirable to use the install.ps1 powershell to add the targets file for backwards compatibility and to determine when a Publish specific targets/props can be added, so web application can be better supported.
I'm not sure if its possible to include a targets/props in a nuget package that only targets web applications, so we don't cause problems for class libraries.

@nulltoken
Copy link
Member

@sitereactor I've googled a bit regarding this and found many references to <CopyAllFilesToSingleFolderForMsdeployDependsOn/>. Could that be of any help in this case?

</Content>
</ItemGroup>
</Target>
<Target Name="AddLibGitFilesToOutput">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who would consume this target? I'm not a msbuild wizard, so please bear with me if I missed something obvious.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well thats odd. That target sneaked back in. It was for the Publish pipeline override, but that caused problems when installing the nuget in a class library, so removes it.

@nulltoken
Copy link
Member

Another nitpick: Could you please rebase on the latest vNext? The project has been upgraded to .Net 4.0 and the .nuspec has been upgraded as well.

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="CopyLibGit2SharpBinaries" AfterTargets="ResolveAssemblyReferences">
<PropertyGroup>
<LibGitNativeBinaries>..\packages\LibGit2Sharp.0.17.0.0\lib\net35\NativeBinaries\</LibGitNativeBinaries>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you it would make sense to rely on the same trickery that's used in #425 and avoid hardcoding the version number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I was going to ask about that. Thought it might be possible to add something to the build process. I'll have a look at this when I update the PR.

@nulltoken
Copy link
Member

Could you also please try to tackle the indentations? It looks like some tabs have sneaked in 😄

@sitereactor
Copy link
Contributor Author

Yes, i'll get that fixed up ;-)

@sitereactor
Copy link
Contributor Author

@nulltoken unfortunately, the CopyAllFilesToSingleFolderForMsdeployDependsOn thingy won't work for this. Its specific to MsDeploy/WebDeploy and won't work for class libraries. I want to try if it makes a difference to have multiple targets that are Publish specific. But the main pain point is ensuring that the NativeBinaries are copied to the output dir for projects that reference projects that has LibGit2Sharp installed.

@nulltoken
Copy link
Member

@sitereactor How bad would it be to include two Targets, one that would track AfterBuild (for the class librairies) and another one which would leverage CopyAllFilesToSingleFolderForMsdeployDependsOn?

@sitereactor
Copy link
Contributor Author

@nulltoken I hope that will be a feasible solution. But I havent tried it before so have to test it first. If that type of approach doesn't work I think the only other option. Would be to include a install.ps1 to help install the right targets instead of relaying on nuget to do it (but on the plus side it would be backwards compatible for nuget install prior to 2.5).

nulltoken and others added 14 commits May 2, 2014 13:02
Doing a simple copy of the byte array is a lot faster than using
Marshal.PtrToStructure.
Deprecate RemoteCollection.IsValidName(string).

Update test CanTellIfARemoteNameIsValid(string, bool).

Fixes #679
Introduced NativeMethods.Capabilities .

Added CanCreateValidVersionString() test .

Displaced NativeMethods CompiledFeatures to Proxy

Remove irrelevant region on Proxy

Make Proxy.get_compiled_features match get_libgit2_features .

Add mising [Flags] tag on GitBuiltInFeatures .

Remote trailling whitespace in Proxy

Resolves #676
Deprecated ReferenceCollection.IsValidName(string) .

Updated Test .

Fixes #680

Fixed typo in [Obsolete] tag.

Rebase into current vNext.
in RepositoryFixture

Updated Repository.Version documentation

Updated Repository.Version test
regex now checks each group.

Fixes #696
Updating targets file to ensure that NativeBinaries are copied to the bin for projects as well as referencing projects.
@sitereactor sitereactor closed this May 2, 2014
@sitereactor
Copy link
Contributor Author

@nulltoken I closed this PR and opened up #705 as I messed up the rebase and second commit to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants