@@ -131,12 +131,22 @@ static void Main(string[] args)
131131 project . WriteLine ( " <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>" ) ;
132132 project . WriteLine ( " <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>" ) ;
133133 project . WriteLine ( $ " <AssemblyName>{ invocation . AssemblyName } </AssemblyName>") ;
134+ int idx = 1 ;
134135 if ( invocation . Parsed . CompilationOptions is CSharpCompilationOptions cSharpOptions )
135136 {
136137 if ( cSharpOptions . AllowUnsafe )
137138 {
138139 project . WriteLine ( " <AllowUnsafeBlocks>true</AllowUnsafeBlocks>" ) ;
139140 }
141+ if ( cSharpOptions . PublicSign )
142+ {
143+ project . WriteLine ( " <PublicSign>true</PublicSign>" ) ;
144+ }
145+ if ( cSharpOptions . CryptoKeyFile != null )
146+ {
147+ includeFile ( cSharpOptions . CryptoKeyFile , out string projectRelativePath , out _ ) ;
148+ project . WriteLine ( $ " <KeyOriginatorFile>{ projectRelativePath } </KeyOriginatorFile>") ;
149+ }
140150 }
141151
142152 if ( invocation . Parsed . ParseOptions is CSharpParseOptions cSharpParseOptions )
@@ -146,36 +156,10 @@ static void Main(string[] args)
146156 }
147157 project . WriteLine ( " </PropertyGroup>" ) ;
148158 project . WriteLine ( " <ItemGroup>" ) ;
149- int idx = 1 ;
150159 foreach ( CommandLineSourceFile sourceFile in invocation . Parsed . SourceFiles )
151160 {
152- string filePath = Path . GetFullPath ( sourceFile . Path ) ;
153- string repoRelativePath = Path . GetRelativePath ( repoRoot , filePath ) ;
154- string projectRelativePath ;
155- string outputFile ;
156- string link = null ;
157- if ( repoRelativePath . StartsWith ( "..\\ " , StringComparison . Ordinal ) || repoRelativePath . StartsWith ( "../" , StringComparison . Ordinal ) || Path . IsPathRooted ( repoRelativePath ) )
158- {
159- string externalPath = Path . Join ( "_external" , idx ++ . ToString ( ) , Path . GetFileName ( filePath ) ) ;
160- // not in the repo dir, treat as external
161- projectRelativePath = Path . Join ( Path . GetRelativePath ( invocation . ProjectDirectory , repoRoot ) , ".." , externalPath ) ;
162- outputFile = Path . Join ( output , externalPath ) ;
163- }
164- else
165- {
166- projectRelativePath = Path . GetRelativePath ( invocation . ProjectDirectory , filePath ) ;
167- if ( projectRelativePath . StartsWith ( ".." , StringComparison . Ordinal ) )
168- {
169- link = repoRelativePath ;
170- }
171- outputFile = Path . Join ( output , "src" , repoRelativePath ) ;
172- }
161+ includeFile ( sourceFile . Path , out string projectRelativePath , out string link ) ;
173162 project . WriteLine ( $ " <Compile Include=\" { projectRelativePath } \" { ( link != null ? $ " Link=\" { link } \" " : "" ) } />") ;
174- Directory . CreateDirectory ( Path . GetDirectoryName ( outputFile ) ) ;
175- if ( ! File . Exists ( outputFile ) )
176- {
177- File . Copy ( filePath , outputFile ) ;
178- }
179163 }
180164 project . WriteLine ( " </ItemGroup>" ) ;
181165 project . WriteLine ( " <ItemGroup>" ) ;
@@ -201,6 +185,35 @@ static void Main(string[] args)
201185 Directory . CreateDirectory ( Path . GetDirectoryName ( outputFilePath ) ) ;
202186 File . Copy ( invocation . OutputAssemblyPath , outputFilePath , true ) ;
203187 }
188+
189+ void includeFile ( string originalPath , out string projectRelativePath , out string link )
190+ {
191+ string filePath = Path . GetFullPath ( originalPath ) ;
192+ string repoRelativePath = Path . GetRelativePath ( repoRoot , filePath ) ;
193+ string outputFile ;
194+ link = null ;
195+ if ( repoRelativePath . StartsWith ( "..\\ " , StringComparison . Ordinal ) || repoRelativePath . StartsWith ( "../" , StringComparison . Ordinal ) || Path . IsPathRooted ( repoRelativePath ) )
196+ {
197+ string externalPath = Path . Join ( "_external" , idx ++ . ToString ( ) , Path . GetFileName ( filePath ) ) ;
198+ // not in the repo dir, treat as external
199+ projectRelativePath = Path . Join ( Path . GetRelativePath ( invocation . ProjectDirectory , repoRoot ) , ".." , externalPath ) ;
200+ outputFile = Path . Join ( output , externalPath ) ;
201+ }
202+ else
203+ {
204+ projectRelativePath = Path . GetRelativePath ( invocation . ProjectDirectory , filePath ) ;
205+ if ( projectRelativePath . StartsWith ( ".." , StringComparison . Ordinal ) )
206+ {
207+ link = repoRelativePath ;
208+ }
209+ outputFile = Path . Join ( output , "src" , repoRelativePath ) ;
210+ }
211+ Directory . CreateDirectory ( Path . GetDirectoryName ( outputFile ) ) ;
212+ if ( ! File . Exists ( outputFile ) )
213+ {
214+ File . Copy ( filePath , outputFile ) ;
215+ }
216+ }
204217 }
205218
206219 Console . WriteLine ( "Finished" ) ;
0 commit comments