@@ -163,24 +163,28 @@ private void Expand(List<string> bimlScriptPaths, Project project, string projec
163163
164164
165165 List < string > newProjectFiles = new List < string > ( ) ;
166- string [ ] newPackageFiles = Directory . GetFiles ( tempTargetDirectory , "*.dtsx" , SearchOption . AllDirectories ) ;
167- newProjectFiles . AddRange ( newPackageFiles ) ;
168-
169166#if ( ! YUKON && ! KATMAI )
170167 //IF DENALI or later...
171168 // Read packages AND project connection managers
172169 string [ ] newConnFiles = Directory . GetFiles ( tempTargetDirectory , "*.conmgr" , SearchOption . AllDirectories ) ;
173170 newProjectFiles . AddRange ( newConnFiles ) ;
174171#endif
172+
173+ string [ ] newPackageFiles = Directory . GetFiles ( tempTargetDirectory , "*.dtsx" , SearchOption . AllDirectories ) ;
174+ newProjectFiles . AddRange ( newPackageFiles ) ;
175+
175176 var safePackageFilePaths = new List < string > ( ) ;
176177 var conflictingPackageFilePaths = new List < string > ( ) ;
178+ var conflictingPackageHighlights = new List < bool > ( ) ;
177179 foreach ( var tempFilePath in newProjectFiles )
178180 {
179181 string tempFileName = Path . GetFileName ( tempFilePath ) ;
180182 string projectItemFileName = Path . Combine ( projectDirectory , tempFileName ) ;
181183 if ( File . Exists ( projectItemFileName ) )
182184 {
183185 conflictingPackageFilePaths . Add ( tempFilePath ) ;
186+ bool readOnly = new FileInfo ( projectItemFileName ) . IsReadOnly ;
187+ conflictingPackageHighlights . Add ( readOnly ) ;
184188 }
185189 else
186190 {
@@ -190,7 +194,7 @@ private void Expand(List<string> bimlScriptPaths, Project project, string projec
190194
191195 if ( conflictingPackageFilePaths . Count > 0 )
192196 {
193- var dialog = new MultipleSelectionConfirmationDialog ( conflictingPackageFilePaths , projectDirectory , safePackageFilePaths . Count ) ;
197+ var dialog = new MultipleSelectionConfirmationDialog ( conflictingPackageFilePaths , conflictingPackageHighlights , projectDirectory , safePackageFilePaths . Count ) ;
194198 if ( dialog . ShowDialog ( ) == DialogResult . OK )
195199 {
196200 foreach ( var filePath in dialog . SelectedFilePaths )
@@ -337,6 +341,14 @@ private void Expand(List<string> bimlScriptPaths, Project project, string projec
337341 foreach ( var tempFilePath in safePackageFilePaths )
338342 {
339343 string projectItemFilePath = Path . Combine ( projectDirectory , Path . GetFileName ( tempFilePath ) ) ;
344+
345+ // Check for read-only and try and overwrite
346+ FileAttributes attributes = File . GetAttributes ( projectItemFilePath ) ;
347+ if ( attributes . HasFlag ( FileAttributes . ReadOnly ) )
348+ {
349+ File . SetAttributes ( projectItemFilePath , attributes & ~ FileAttributes . ReadOnly ) ;
350+ }
351+
340352 File . Copy ( tempFilePath , projectItemFilePath , true ) ;
341353 project . ProjectItems . AddFromFile ( projectItemFilePath ) ;
342354 }
0 commit comments