forked from aspnet/Razor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VSIX.targets
69 lines (57 loc) · 2.58 KB
/
VSIX.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<Project>
<PropertyGroup>
<PackageDependsOn Condition="'$(OS)'=='Windows_NT'">$(PackageDependsOn);GenerateVSIX</PackageDependsOn>
<NuGetCommandLineVersion>3.5.0</NuGetCommandLineVersion>
<VSIXName>Microsoft.VisualStudio.RazorExtension</VSIXName>
<VSIXProject>$(RepositoryRoot)tooling\$(VSIXName)\$(VSIXName).csproj</VSIXProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGet.CommandLine" Version="$(NuGetCommandLineVersion)" Condition="'$(OS)'=='Windows_NT'" />
</ItemGroup>
<Target
Name="GenerateVSIX"
DependsOnTargets="_LocateMSBuildExe;_BuildVSIX"
Condition="'$(OS)'=='Windows_NT'" />
<Target Name="_LocateMSBuildExe" Condition="Exists('$(MSBuildProgramFiles32)')">
<ItemGroup>
<MSBuild15ExePaths Include="$(MSBuildProgramFiles32)\Microsoft Visual Studio\**\MSBuild\15.0\Bin\MSBuild.exe" />
</ItemGroup>
<Warning
Text="Unable to locate MSBuild 15.0 under $(MSBuildProgramFiles32)\Microsoft Visual Studio"
Condition="'@(MSBuild15ExePaths)'==''"/>
<PropertyGroup Condition="'@(MSBuild15ExePaths)'!=''">
<MSBuildExePath>%(MSBuild15ExePaths.FullPath)</MSBuildExePath>
</PropertyGroup>
</Target>
<Target Name="_RestoreProject">
<PropertyGroup>
<NuGetExe>$([MSBuild]::EnsureTrailingSlash('$(NuGetPackageRoot)'))nuget.commandline\$(NuGetCommandLineVersion)\tools\nuget.exe</NuGetExe>
</PropertyGroup>
<Exec Command="$(NuGetExe) restore "$(VSIXProject)" -SolutionDir "$(RepositoryRoot) " -verbosity quiet" />
</Target>
<Target Name="_BuildVSIX" Condition="'$(MSBuildExePath)'!=''">
<PropertyGroup>
<MSBuildArtifactsDir>$(ArtifactsDir)msbuild\</MSBuildArtifactsDir>
<VSIXLogFilePath>$(MSBuildArtifactsDir)vsix.log</VSIXLogFilePath>
<VSIXResponseFilePath>$(MSBuildArtifactsDir)vsix.rsp</VSIXResponseFilePath>
<VSIXOutputPath>$(BuildDir)$(VSIXName).vsix</VSIXOutputPath>
</PropertyGroup>
<CallTarget Targets="_RestoreProject" />
<ItemGroup>
<MSBuildArguments Include="
$(VSIXProject);
/v:M;
/fl;
/flp:LogFile=$(VSIXLogFilePath);
/p:DeployExtension=false;
/p:TargetVSIXContainer=$(VSIXOutputPath);
/p:Configuration=$(Configuration);" />
</ItemGroup>
<MakeDir Directories="$(MSBuildArtifactsDir)" Condition="!Exists('$(MSBuildArtifactsDir)')" />
<WriteLinesToFile
File="$(VSIXResponseFilePath)"
Lines="@(MSBuildArguments)"
Overwrite="true" />
<Exec Command=""$(MSBuildExePath)" @"$(VSIXResponseFilePath)"" />
</Target>
</Project>