Skip to content

Commit

Permalink
Added nuget package restore and removed culture info from assembly info.
Browse files Browse the repository at this point in the history
  • Loading branch information
dynajoe committed Sep 6, 2012
1 parent 0e28456 commit 850752e
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 43 deletions.
6 changes: 6 additions & 0 deletions .nuget/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
Binary file added .nuget/NuGet.exe
Binary file not shown.
143 changes: 143 additions & 0 deletions .nuget/NuGet.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>

<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>

<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>

<!-- Determines if package restore consent is required to restore packages -->
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>

<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
</PropertyGroup>

<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
<!--
<PackageSource Include="https://nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
<PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
</PropertyGroup>

<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
<PackagesConfig>packages.config</PackagesConfig>
<PackagesDir>$(SolutionDir)packages</PackagesDir>
</PropertyGroup>

<PropertyGroup>
<!-- NuGet command -->
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\nuget.exe</NuGetExePath>
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>

<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>

<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>

<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -o "$(PackagesDir)"</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>

<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
</BuildDependsOn>

<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
$(BuildDependsOn);
BuildPackage;
</BuildDependsOn>
</PropertyGroup>

<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
<SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>

<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />

<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
</Target>

<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />

<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>

<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);
Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>

<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<EnvKey ParameterType="System.String" Required="true" />
<EnvValue ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
}
catch {
}
]]>
</Code>
</Task>
</UsingTask>
</Project>
91 changes: 49 additions & 42 deletions Garlic.sln
Original file line number Diff line number Diff line change
@@ -1,42 +1,49 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Garlic", "Garlic\Garlic.csproj", "{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Garlic.Sample.WPF", "Garlic.Sample.WPF\Garlic.Sample.WPF.csproj", "{CAD81276-6EB6-42B3-9352-03592860ED4A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Debug|x86.ActiveCfg = Debug|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Release|Any CPU.Build.0 = Release|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Release|x86.ActiveCfg = Release|Any CPU
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Debug|Any CPU.ActiveCfg = Debug|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Debug|Mixed Platforms.Build.0 = Debug|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Debug|x86.ActiveCfg = Debug|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Debug|x86.Build.0 = Debug|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Release|Any CPU.ActiveCfg = Release|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Release|Mixed Platforms.ActiveCfg = Release|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Release|Mixed Platforms.Build.0 = Release|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Release|x86.ActiveCfg = Release|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Garlic", "Garlic\Garlic.csproj", "{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Garlic.Sample.WPF", "Garlic.Sample.WPF\Garlic.Sample.WPF.csproj", "{CAD81276-6EB6-42B3-9352-03592860ED4A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{27C41484-2BB4-4AC1-A381-3646EABDB41A}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Debug|x86.ActiveCfg = Debug|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Release|Any CPU.Build.0 = Release|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{CC6DCA91-9D5A-4603-B8CA-C9597A9D3107}.Release|x86.ActiveCfg = Release|Any CPU
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Debug|Any CPU.ActiveCfg = Debug|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Debug|Mixed Platforms.Build.0 = Debug|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Debug|x86.ActiveCfg = Debug|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Debug|x86.Build.0 = Debug|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Release|Any CPU.ActiveCfg = Release|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Release|Mixed Platforms.ActiveCfg = Release|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Release|Mixed Platforms.Build.0 = Release|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Release|x86.ActiveCfg = Release|x86
{CAD81276-6EB6-42B3-9352-03592860ED4A}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
1 change: 0 additions & 1 deletion Garlic/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
[assembly: AssemblyProduct("Garlic Google Analytics Client")]
[assembly: AssemblyCopyright("Copyright © Dusty Burwell 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("en-US")]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

0 comments on commit 850752e

Please sign in to comment.