Skip to content

Commit 3d51122

Browse files
committed
Upgraded NuGet to 2.2. Fixed NuGet issues under Mono.
1 parent aee31a7 commit 3d51122

36 files changed

+196
-190
lines changed

.nuget/NuGet.exe

1 KB
Binary file not shown.

.nuget/NuGet.targets

+139-136
Original file line numberDiff line numberDiff line change
@@ -1,150 +1,153 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<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>
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>
88

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

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>
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, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
21+
<!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
22+
<!--
23+
<PackageSource Include="https://nuget.org/api/v2/" />
24+
<PackageSource Include="https://my-nuget-source/nuget/" />
25+
-->
26+
</ItemGroup>
2627

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>
28+
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
29+
<!-- Windows specific commands -->
30+
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
31+
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
32+
<PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
33+
</PropertyGroup>
34+
35+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
36+
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
37+
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
38+
<PackagesConfig>packages.config</PackagesConfig>
39+
<PackagesDir>$(SolutionDir)packages</PackagesDir>
40+
</PropertyGroup>
41+
42+
<PropertyGroup>
43+
<!-- NuGet command -->
44+
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
45+
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
46+
47+
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
48+
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
4649

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>
50+
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
51+
52+
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
53+
<!-- Commands -->
54+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -o "$(PackagesDir)"</RestoreCommand>
55+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
5356

54-
<!-- We need to ensure packages are restored prior to assembly resolve -->
55-
<ResolveReferencesDependsOn Condition="$(RestorePackages) == 'true'">
56-
RestorePackages;
57-
$(ResolveReferencesDependsOn);
58-
</ResolveReferencesDependsOn>
57+
<!-- We need to ensure packages are restored prior to assembly resolve -->
58+
<ResolveReferencesDependsOn Condition="$(RestorePackages) == 'true'">
59+
RestorePackages;
60+
$(ResolveReferencesDependsOn);
61+
</ResolveReferencesDependsOn>
5962

60-
<!-- Make the build depend on restore packages -->
61-
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
62-
$(BuildDependsOn);
63-
BuildPackage;
64-
</BuildDependsOn>
65-
</PropertyGroup>
63+
<!-- Make the build depend on restore packages -->
64+
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
65+
$(BuildDependsOn);
66+
BuildPackage;
67+
</BuildDependsOn>
68+
</PropertyGroup>
6669

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>
70+
<Target Name="CheckPrerequisites">
71+
<!-- Raise an error if we're unable to locate nuget.exe -->
72+
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
73+
<SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
74+
<!--
75+
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
76+
This effectively acts as a lock that makes sure that the download operation will only happen once and all
77+
parallel builds will have to wait for it to complete.
78+
-->
79+
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT" />
80+
</Target>
7881

79-
<Target Name="_DownloadNuGet">
80-
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
81-
</Target>
82+
<Target Name="_DownloadNuGet">
83+
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
84+
</Target>
8285

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>
86+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
87+
<Exec Command="$(RestoreCommand)"
88+
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
89+
90+
<Exec Command="$(RestoreCommand)"
91+
LogStandardErrorAsError="true"
92+
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
93+
</Target>
9194

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);
95+
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
96+
<Exec Command="$(BuildCommand)"
97+
Condition=" '$(OS)' != 'Windows_NT' " />
98+
99+
<Exec Command="$(BuildCommand)"
100+
LogStandardErrorAsError="true"
101+
Condition=" '$(OS)' == 'Windows_NT' " />
102+
</Target>
103+
104+
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
105+
<ParameterGroup>
106+
<OutputFilename ParameterType="System.String" Required="true" />
107+
</ParameterGroup>
108+
<Task>
109+
<Reference Include="System.Core" />
110+
<Using Namespace="System" />
111+
<Using Namespace="System.IO" />
112+
<Using Namespace="System.Net" />
113+
<Using Namespace="Microsoft.Build.Framework" />
114+
<Using Namespace="Microsoft.Build.Utilities" />
115+
<Code Type="Fragment" Language="cs">
116+
<![CDATA[
117+
try {
118+
OutputFilename = Path.GetFullPath(OutputFilename);
116119
117-
Log.LogMessage("Downloading latest version of NuGet.exe...");
118-
WebClient webClient = new WebClient();
119-
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
120+
Log.LogMessage("Downloading latest version of NuGet.exe...");
121+
WebClient webClient = new WebClient();
122+
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
120123
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>
124+
return true;
125+
}
126+
catch (Exception ex) {
127+
Log.LogErrorFromException(ex);
128+
return false;
129+
}
130+
]]>
131+
</Code>
132+
</Task>
133+
</UsingTask>
134+
135+
<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
136+
<ParameterGroup>
137+
<EnvKey ParameterType="System.String" Required="true" />
138+
<EnvValue ParameterType="System.String" Required="true" />
139+
</ParameterGroup>
140+
<Task>
141+
<Using Namespace="System" />
142+
<Code Type="Fragment" Language="cs">
143+
<![CDATA[
144+
try {
145+
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
146+
}
147+
catch {
148+
}
149+
]]>
150+
</Code>
151+
</Task>
152+
</UsingTask>
153+
</Project>

Browser/Browser.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@
302302
<None Include="Resources\media-playback-start.png" />
303303
</ItemGroup>
304304
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
305-
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
305+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" />
306306
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
307307
Other similar extension points exist, see Microsoft.Common.targets.
308308
<Target Name="BeforeBuild">
@@ -314,4 +314,4 @@
314314
<Target Name="AfterBuild">
315315
<Gendarme Condition=" '$(Configuration)' == 'Release' AND '$(OS)' == 'Windows_NT' " Assemblies="$(TargetPath)" WarningsAsErrors="False" IntegrateWithVisualStudio="True" GendarmeIgnoreFilename="../SharpSnmpLib/gendarme.ignore" />
316316
</Target>-->
317-
</Project>
317+
</Project>

Compiler/Compiler.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
</None>
209209
</ItemGroup>
210210
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
211-
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
211+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" />
212212
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
213213
Other similar extension points exist, see Microsoft.Common.targets.
214214
<Target Name="BeforeBuild">
@@ -220,4 +220,4 @@
220220
<Target Name="AfterBuild">
221221
<Gendarme Condition=" '$(Configuration)' == 'Release' AND '$(OS)' == 'Windows_NT' " Assemblies="$(TargetPath)" WarningsAsErrors="False" IntegrateWithVisualStudio="True" GendarmeIgnoreFilename="../SharpSnmpLib/gendarme.ignore" />
222222
</Target>-->
223-
</Project>
223+
</Project>

Mono.Options/Mono.Options.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@
5454
<Compile Include="Properties\AssemblyInfo.cs" />
5555
</ItemGroup>
5656
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
57-
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
57+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" />
5858
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
5959
Other similar extension points exist, see Microsoft.Common.targets.
6060
<Target Name="BeforeBuild">
6161
</Target>
6262
<Target Name="AfterBuild">
6363
</Target>
6464
-->
65-
</Project>
65+
</Project>

RemObjects.Mono.Helpers/RemObjects.Mono.Helpers.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@
5555
<None Include="monohelpers.snk" />
5656
</ItemGroup>
5757
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
58-
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
58+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" />
5959
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
6060
Other similar extension points exist, see Microsoft.Common.targets.
6161
<Target Name="BeforeBuild">
6262
</Target>
6363
<Target Name="AfterBuild">
6464
</Target>
6565
-->
66-
</Project>
66+
</Project>

Samples/C#/snmpbulkget/snmpbulkget.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@
8383
<None Include="app.config" />
8484
</ItemGroup>
8585
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
86-
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
86+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" />
8787
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
8888
Other similar extension points exist, see Microsoft.Common.targets.
8989
<Target Name="BeforeBuild">
9090
</Target>
9191
<Target Name="AfterBuild">
9292
</Target>
9393
-->
94-
</Project>
94+
</Project>

Samples/C#/snmpdiscover/snmpdiscover.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@
7676
<None Include="app.config" />
7777
</ItemGroup>
7878
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
79-
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
79+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" />
8080
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
8181
Other similar extension points exist, see Microsoft.Common.targets.
8282
<Target Name="BeforeBuild">
8383
</Target>
8484
<Target Name="AfterBuild">
8585
</Target>
8686
-->
87-
</Project>
87+
</Project>

0 commit comments

Comments
 (0)