@@ -88,8 +88,15 @@ public IEnumerable<FileName> GetTypeScriptFileNames()
8888 . Select ( item => item . FileName ) ;
8989 }
9090
91+ bool HasMSBuildProject {
92+ get { return msbuildProject != null ; }
93+ }
94+
9195 string GetStringProperty ( BuildConfiguration buildConfig , string name , string defaultValue )
9296 {
97+ if ( ! HasMSBuildProject )
98+ return defaultValue ;
99+
93100 string propertyValue = msbuildProject . GetProperty ( buildConfig . Configuration , buildConfig . Platform , name ) ;
94101 if ( ! String . IsNullOrEmpty ( propertyValue ) ) {
95102 return propertyValue ;
@@ -99,6 +106,9 @@ string GetStringProperty(BuildConfiguration buildConfig, string name, string def
99106
100107 bool GetBooleanProperty ( BuildConfiguration buildConfig , string name , bool defaultValue )
101108 {
109+ if ( ! HasMSBuildProject )
110+ return defaultValue ;
111+
102112 string propertyValue = msbuildProject . GetProperty ( buildConfig . Configuration , buildConfig . Platform , name ) ;
103113 return ConvertBooleanValue ( propertyValue , defaultValue ) ;
104114 }
@@ -119,6 +129,9 @@ void SetBooleanProperty(BuildConfiguration buildConfig, string name, bool value)
119129
120130 void SetStringProperty ( BuildConfiguration buildConfig , string name , string value )
121131 {
132+ if ( ! HasMSBuildProject )
133+ return ;
134+
122135 msbuildProject . SetProperty (
123136 buildConfig . Configuration ,
124137 buildConfig . Platform ,
@@ -130,12 +143,18 @@ void SetStringProperty(BuildConfiguration buildConfig, string name, string value
130143
131144 bool GetBooleanProperty ( string name , bool defaultValue )
132145 {
146+ if ( ! HasMSBuildProject )
147+ return defaultValue ;
148+
133149 string propertyValue = msbuildProject . GetEvaluatedProperty ( name ) ;
134150 return ConvertBooleanValue ( propertyValue , defaultValue ) ;
135151 }
136152
137153 string GetStringProperty ( string name , string defaultValue )
138154 {
155+ if ( ! HasMSBuildProject )
156+ return defaultValue ;
157+
139158 string propertyValue = msbuildProject . GetEvaluatedProperty ( name ) ;
140159 if ( ! String . IsNullOrEmpty ( propertyValue ) ) {
141160 return propertyValue ;
0 commit comments