Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Save solution nuget configuration.

  • Loading branch information...
commit 740c5191cecbcdc1845bcc72b13942b682ff7aed 1 parent b85d8ed
authored December 11, 2012
6  .nuget/NuGet.Config
... ...
@@ -0,0 +1,6 @@
  1
+<?xml version="1.0" encoding="utf-8"?>
  2
+<configuration>
  3
+  <solution>
  4
+    <add key="disableSourceControlIntegration" value="true" />
  5
+  </solution>
  6
+</configuration>
150  .nuget/NuGet.targets
... ...
@@ -0,0 +1,150 @@
  1
+<?xml version="1.0" encoding="utf-8"?>
  2
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3
+    <PropertyGroup>
  4
+        <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
  5
+        
  6
+        <!-- Enable the restore command to run before builds -->
  7
+        <RestorePackages Condition="  '$(RestorePackages)' == '' ">false</RestorePackages>
  8
+
  9
+        <!-- Property that enables building a package from a project -->
  10
+        <BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
  11
+
  12
+        <!-- Determines if package restore consent is required to restore packages -->
  13
+        <RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
  14
+        
  15
+        <!-- Download NuGet.exe if it does not already exist -->
  16
+        <DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
  17
+    </PropertyGroup>
  18
+    
  19
+    <ItemGroup Condition=" '$(PackageSources)' == '' ">
  20
+        <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
  21
+        <!--
  22
+            <PackageSource Include="https://nuget.org/api/v2/" />
  23
+            <PackageSource Include="https://my-nuget-source/nuget/" />
  24
+        -->
  25
+    </ItemGroup>
  26
+
  27
+    <PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
  28
+        <!-- Windows specific commands -->
  29
+        <NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
  30
+        <PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
  31
+    </PropertyGroup>
  32
+    
  33
+    <PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
  34
+        <!-- We need to launch nuget.exe with the mono command if we're not on windows -->
  35
+        <NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
  36
+        <PackagesConfig>packages.config</PackagesConfig>
  37
+    </PropertyGroup>
  38
+    
  39
+    <PropertyGroup>
  40
+        <!-- NuGet command -->
  41
+        <NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\nuget.exe</NuGetExePath>
  42
+        <PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
  43
+        
  44
+        <NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
  45
+        <NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
  46
+
  47
+        <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
  48
+        
  49
+        <RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
  50
+        <!-- Commands -->
  51
+        <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)"  $(RequireConsentSwitch) -solutionDir "$(SolutionDir) "</RestoreCommand>
  52
+        <BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
  53
+
  54
+        <!-- We need to ensure packages are restored prior to assembly resolve -->
  55
+        <ResolveReferencesDependsOn Condition="$(RestorePackages) == 'true'">
  56
+            RestorePackages;
  57
+            $(ResolveReferencesDependsOn);
  58
+        </ResolveReferencesDependsOn>
  59
+
  60
+        <!-- Make the build depend on restore packages -->
  61
+        <BuildDependsOn Condition="$(BuildPackage) == 'true'">
  62
+            $(BuildDependsOn);
  63
+            BuildPackage;
  64
+        </BuildDependsOn>
  65
+    </PropertyGroup>
  66
+
  67
+    <Target Name="CheckPrerequisites">
  68
+        <!-- Raise an error if we're unable to locate nuget.exe  -->
  69
+        <Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
  70
+        <SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
  71
+        <!--
  72
+        Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
  73
+        This effectively acts as a lock that makes sure that the download operation will only happen once and all
  74
+        parallel builds will have to wait for it to complete.
  75
+        -->
  76
+        <MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT" />
  77
+    </Target>
  78
+
  79
+    <Target Name="_DownloadNuGet">
  80
+        <DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
  81
+    </Target>
  82
+
  83
+    <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
  84
+        <Exec Command="$(RestoreCommand)"
  85
+              Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
  86
+              
  87
+        <Exec Command="$(RestoreCommand)"
  88
+              LogStandardErrorAsError="true"
  89
+              Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
  90
+    </Target>
  91
+
  92
+    <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
  93
+        <Exec Command="$(BuildCommand)" 
  94
+              Condition=" '$(OS)' != 'Windows_NT' " />
  95
+              
  96
+        <Exec Command="$(BuildCommand)"
  97
+              LogStandardErrorAsError="true"
  98
+              Condition=" '$(OS)' == 'Windows_NT' " />
  99
+    </Target>
  100
+    
  101
+    <UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
  102
+        <ParameterGroup>
  103
+            <OutputFilename ParameterType="System.String" Required="true" />
  104
+        </ParameterGroup>
  105
+        <Task>
  106
+            <Reference Include="System.Core" />
  107
+            <Using Namespace="System" />
  108
+            <Using Namespace="System.IO" />
  109
+            <Using Namespace="System.Net" />
  110
+            <Using Namespace="Microsoft.Build.Framework" />
  111
+            <Using Namespace="Microsoft.Build.Utilities" />
  112
+            <Code Type="Fragment" Language="cs">
  113
+                <![CDATA[
  114
+                try {
  115
+                    OutputFilename = Path.GetFullPath(OutputFilename);
  116
+
  117
+                    Log.LogMessage("Downloading latest version of NuGet.exe...");
  118
+                    WebClient webClient = new WebClient();
  119
+                    webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
  120
+
  121
+                    return true;
  122
+                }
  123
+                catch (Exception ex) {
  124
+                    Log.LogErrorFromException(ex);
  125
+                    return false;
  126
+                }
  127
+            ]]>
  128
+            </Code>
  129
+        </Task>
  130
+    </UsingTask>
  131
+    
  132
+     <UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
  133
+        <ParameterGroup>
  134
+            <EnvKey ParameterType="System.String" Required="true" />
  135
+            <EnvValue ParameterType="System.String" Required="true" />
  136
+        </ParameterGroup>
  137
+        <Task>
  138
+            <Using Namespace="System" />
  139
+            <Code Type="Fragment" Language="cs">
  140
+                <![CDATA[
  141
+                try {
  142
+                    Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
  143
+                }
  144
+                catch  {
  145
+                }
  146
+            ]]>
  147
+            </Code>
  148
+        </Task>
  149
+    </UsingTask>
  150
+</Project>
2  Sider.sln
@@ -24,7 +24,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sider.Samples", "src\Sider.
24 24
 EndProject
25 25
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sider.Samples.Chat", "src\Sider.Samples.Chat\Sider.Samples.Chat.csproj", "{2BFB74C2-DBD4-4F30-A672-71161D4BBCC6}"
26 26
 EndProject
27  
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{23283EE4-4DE5-4B6D-8CB7-28877B9C2CA3}"
  27
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{F1046F7D-4870-4FB4-A6DF-B2082B82AA5B}"
28 28
 	ProjectSection(SolutionItems) = preProject
29 29
 		.nuget\NuGet.Config = .nuget\NuGet.Config
30 30
 		.nuget\NuGet.exe = .nuget\NuGet.exe

0 notes on commit 740c519

Please sign in to comment.
Something went wrong with that request. Please try again.