File tree Expand file tree Collapse file tree 6 files changed +115
-0
lines changed Expand file tree Collapse file tree 6 files changed +115
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ of patent rights can be found in the PATENTS file in the same directory.
26
26
<PackageAssemblies Include =" React.Web.Mvc3" />
27
27
<PackageAssemblies Include =" System.Web.Optimization.React" />
28
28
<PackageAssemblies Include =" Cassette.React" />
29
+ <PackageAssemblies Include =" React.MSBuild" />
29
30
</ItemGroup >
30
31
31
32
<Import Project =" $(MSBuildProjectDirectory)\tools\MSBuildTasks\MSBuild.Community.Tasks.Targets" />
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <Project xmlns =" http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets =" TransformJsx" >
3
+ <!-- ReactJS.NET - Transforms JSX to JavaScript -->
4
+ <UsingTask AssemblyFile =" $(OutputPath)\React.MSBuild.dll" TaskName =" TransformJsx" />
5
+ <Target Name =" TransformJsx" >
6
+ <TransformJsx SourceDir =" $(MSBuildProjectDirectory)" />
7
+ </Target >
8
+ </Project >
Original file line number Diff line number Diff line change 59
59
<Name >React</Name >
60
60
</ProjectReference >
61
61
</ItemGroup >
62
+ <ItemGroup >
63
+ <None Include =" Content\TransformJsx.proj" />
64
+ <None Include =" tools\install.ps1" />
65
+ <None Include =" React.MSBuild.nutrans" />
66
+ <None Include =" tools\uninstall.ps1" />
67
+ </ItemGroup >
62
68
<Import Project =" $(MSBuildToolsPath)\Microsoft.CSharp.targets" />
63
69
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
64
70
Other similar extension points exist, see Microsoft.Common.targets.
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <!--
3
+ Copyright (c) 2014, Facebook, Inc.
4
+ All rights reserved.
5
+
6
+ This source code is licensed under the BSD-style license found in the
7
+ LICENSE file in the root directory of this source tree. An additional grant
8
+ of patent rights can be found in the PATENTS file in the same directory.
9
+ -->
10
+ <package
11
+ xmlns=" http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
12
+ xmlns:xdt=" http://schemas.microsoft.com/XML-Document-Transform" >
13
+ <metadata >
14
+ <id xdt : Transform =" Replace" >React.MSBuild</id >
15
+ <title xdt : Transform =" Insert" >ReactJS.NET - JSX for MSBuild</title >
16
+ <description xdt : Transform =" Insert" >Allows you to compile JSX to JavaScript via an MSBuild task</description >
17
+ <tags xdt : Transform =" Replace" >asp.net mvc asp jquery javascript js react facebook reactjs msbuild</tags >
18
+ </metadata >
19
+ <files xdt : Transform =" Insert" >
20
+ <file src =" Content\TransformJsx.proj" target =" Content\" />
21
+ <file src =" tools\install.ps1" target =" tools\" />
22
+ <file src =" tools\uninstall.ps1" target =" tools\" />
23
+ </files >
24
+ </package >
Original file line number Diff line number Diff line change
1
+ function Resolve-ProjectName {
2
+ param (
3
+ [parameter (ValueFromPipelineByPropertyName = $true )]
4
+ [string []]$ProjectName
5
+ )
6
+
7
+ if ($ProjectName ) {
8
+ $projects = Get-Project $ProjectName
9
+ }
10
+ else {
11
+ # All projects by default
12
+ $projects = Get-Project
13
+ }
14
+
15
+ $projects
16
+ }
17
+
18
+ function Get-MSBuildProject {
19
+ param (
20
+ [parameter (ValueFromPipelineByPropertyName = $true )]
21
+ [string []]$ProjectName
22
+ )
23
+ Process {
24
+ (Resolve-ProjectName $ProjectName ) | % {
25
+ $path = $_.FullName
26
+ @ ([Microsoft.Build.Evaluation.ProjectCollection ]::GlobalProjectCollection.GetLoadedProjects($path ))[0 ]
27
+ }
28
+ }
29
+ }
30
+
31
+ $project = Get-Project
32
+ $buildProject = Get-MSBuildProject
33
+ $target = $buildProject.Xml.AddTarget (" TransformJsx" )
34
+ $target.AfterTargets = " Build"
35
+ $task = $target.AddTask (" Exec" )
36
+ $task.SetParameter (" Command" , ' "$(msbuildtoolspath)\msbuild.exe" $(ProjectDirectory)TransformJsx.proj /p:OutputPath=$(OutputPath) /nr:false' )
37
+ $project.Save ()
Original file line number Diff line number Diff line change
1
+ function Resolve-ProjectName {
2
+ param (
3
+ [parameter (ValueFromPipelineByPropertyName = $true )]
4
+ [string []]$ProjectName
5
+ )
6
+
7
+ if ($ProjectName ) {
8
+ $projects = Get-Project $ProjectName
9
+ }
10
+ else {
11
+ # All projects by default
12
+ $projects = Get-Project
13
+ }
14
+
15
+ $projects
16
+ }
17
+
18
+ function Get-MSBuildProject {
19
+ param (
20
+ [parameter (ValueFromPipelineByPropertyName = $true )]
21
+ [string []]$ProjectName
22
+ )
23
+ Process {
24
+ (Resolve-ProjectName $ProjectName ) | % {
25
+ $path = $_.FullName
26
+ @ ([Microsoft.Build.Evaluation.ProjectCollection ]::GlobalProjectCollection.GetLoadedProjects($path ))[0 ]
27
+ }
28
+ }
29
+ }
30
+
31
+ $project = Get-Project
32
+ $buildProject = Get-MSBuildProject
33
+
34
+ $existingImports = $buildProject.Xml.Targets | where {$_.Name -eq " TransformJsx" }
35
+ foreach ($import in $existingImports ) {
36
+ $buildProject.Xml.RemoveChild ($import )
37
+ }
38
+
39
+ $project.Save ()
You can’t perform that action at this time.
0 commit comments