Bug 38751 - [XVS 4.0] Installer creates misplaced C:\ImportAfter\Xamarin.Common.targets file
Summary: [XVS 4.0] Installer creates misplaced C:\ImportAfter\Xamarin.Common.targets file
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Installer ()
Version: 4.0.0 (C6)
Hardware: PC Windows
: Low minor
Target Milestone: 15.5
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-02-15 04:26 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2017-09-14 19:06 UTC (History)
12 users (show)

Tags: BZRC6S1_C5SR5S1 ac
Is this bug a regression?: Yes
Last known good build: Cycle 5 SR 5


Attachments
Screenshot of installer settings used to replicate (29.32 KB, image/png)
2016-02-15 04:26 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Verbose MSI installer log (1.08 MB, application/zip)
2016-12-23 22:13 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Supplemental MSI installer log (this time testing with no spaces in .msi path or user name) (1.13 MB, application/zip)
2016-12-23 22:24 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Verbose MSI installer log (1.88 MB, application/zip)
2017-06-22 23:30 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
MSInstallerLogs (3.77 MB, application/x-zip-compressed)
2017-07-28 13:04 UTC, Swati Gangrade
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_ON_ROADMAP

Description Brendan Zagaeski (Xamarin Team, assistant) 2016-02-15 04:26:45 UTC
Created attachment 15040 [details]
Screenshot of installer settings used to replicate

[XVS 4.0] Installer creates misplaced C:\ImportAfter\Xamarin.Common.targets file




## Regression status: regression in Cycle 6

BAD:  XamarinVS master/3b2082e28c59fd72b4e71a695f615a2029ed1cdc
BAD:  XamarinVS 4.0.1.96   (dcea9c1) Cycle 6 – Service Release 1
BAD:  XamarinVS 4.0.0.1689 (f860fe4) Cycle 6
GOOD: XamarinVS 3.11.1594  (a06d6d5) Cycle 5 – Service Release 5




## Steps to replicate

Install Xamarin on Windows. For this test you can skip the VS extensions for simplicity (see attached screenshot).




## Results

The installer creates the following directory and file:

> C:\ImportAfter\Xamarin.Common.targets 




## Expected results

The installer should not create a `C:\ImportAfter` directory. My guess would be that the `Xamarin.Common.targets` file is probably meant to go somewhere in the `C:\Program Files (x86)\MSBuild` folder.
Comment 1 Enzo Heredia 2016-02-24 18:17:57 UTC
this one is fixed in latest build from master
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-15 00:52:52 UTC
## Verification status: not yet fixed as of Cycle 8

BAD: XamarinVS 4.2.0.680 (c4382f51543833deb16514ef8f0d57803e89ce6c)




## Additional version info


My initial test was on:

Windows 10 (64-bit), Version 1607
Visual Studio Enterprise 2015 Update 3


I also got the same results in a few different "empty" Windows environments:

- Windows 10 (64-bit), Version 1607 (with MSBuild Tools 2015 installed)

- Windows 10 (64-bit), Version 10240 (with MSBuild Tools 2015 installed)

- Windows 8.1 (64-bit), Version 6.3 (Build 9600) (with MSBuild Tools 2015 and .NET 4.6.1 installed)
Comment 4 tranb3r 2016-09-28 07:34:26 UTC
Same problem for me with Cycle 8. Xamarin install creates folder F:\ImportAfter\Xamarin.Common.targets, which results in an error during install if drive F: is encrypted and locked.

How can I move this folder to another drive ?
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-28 18:22:22 UTC
## Non-engineering-team reply

@tranb3r, unfortunately that level of workaround is probably outside the scope of this bug report.  The first thought that comes to my mind is that you could temporarily un-assign the F: driver letter (for example via `diskmgmt.msc`) during installation.  If that isn't an option, then Stack Overflow might be a good place to post your question to surface it more visibly to the broader developer community and see what kinds of brainstorming for workarounds it stirs up.  (If possible, it might be advantageous to frame the question initially as a general question about .msi installers since there might be some tricks to redirect any .msi (or at least .msi installers made with Wix) to pick a different install disk for certain files, or to skip the files entirely, which would be fine in this case.  To make one guess, the installer might be picking the volume with the largest amount of free space.  On the other hand, it is also possible that the drive-picking behavior in this case is fairly specific to Xamarin.)

Best,
Brendan
Comment 6 tranb3r 2016-09-29 07:34:03 UTC
@Brendan,

The issue is not about .msi installers in general.
It's about Xamarin installing one single file (Xamarin.Common.targets) in a folder (ImportAfter) that is created at the root of a drive that seems to be picked randomly (which can cause some trouble).
I think this folder/file should rather be created in a standard folder (for example, program files or user data), just like the rest of the files installed by Xamarin.

Instead of "How can I move this folder to another drive ?", my question should have been "Could you please make sure Xamarin installs all files in a standard location ?".

Thanks
Bertrand
Comment 7 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-29 15:33:36 UTC
Correct, that is the reason I filed this bug.  As per the "expected behavior" I described in Comment 0: "The installer should not create a `C:\ImportAfter` directory."
Comment 8 vga 2016-12-23 21:09:15 UTC
Hi Brendan, Bertrand,

If you still can repro this, can you please attach a verbose log of the MSI run where this file got misplaced on disk (msiexec.exe XamarinVS.MSI /l*v log.txt)

That would help understanding what may be going wrong. My guess is that for some reason the expansion of the MS build folder is failing and thus the files end in the root folder.

thanks,
Comment 9 Brendan Zagaeski (Xamarin Team, assistant) 2016-12-23 22:13:10 UTC
Created attachment 18986 [details]
Verbose MSI installer log

I have attached the verbose MSI installer log for an installation that created the C:\ImportAfter\Xamarin.Common.targets file.




## Environment info for this test


XamarinVS 4.2.1.64  (872717c)  (Cycle 8 SR 1)  (November 16, 2016)


Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3

Microsoft Visual Studio Enterprise 2015
Version 14.0.25425.01 Update 3
Microsoft .NET Framework
Version 4.6.01055


Windows 8.1 (64-bit), Version 6.3 (Build 9600)
Comment 10 Brendan Zagaeski (Xamarin Team, assistant) 2016-12-23 22:24:32 UTC
Created attachment 18987 [details]
Supplemental MSI installer log (this time testing with no spaces in .msi path or user name)

## Description of new test conditions used

The log from Comment 9 shows an example where the .msi is stored at a full path that contains spaces.  And the user name also contains a space: "Windows User".

Out of curiosity to see if it might account for any instances where other Xamarin team members are _not_ able to replicate this issue, I tried a quick test where I moved the .msi to a full path that contained _no spaces_ and ran the installation under a user name that also contained _no spaces_: "Winuser".


## Results: unchanged, as shown in the attached log file

Unfortunately, the ImportAfter folder was still created in this case, so it looks like spaces in the full path or user name do not (by themselves) account for any difference in behavior of this bug that might be seen between different test environments.
Comment 12 vga 2016-12-24 04:18:50 UTC
This is confirmed to be a bug in the MSI which is causing _an extra copy_ of the Xamarin.Common.targets file to be copied to:

C:\ImportAfter\Xamarin.Common.targets

Note, another copy of the Xamarin.Common.targets file is still properly copied to the right folder, so the product should continue to work as expected (no build errors due to missing targets).

For now you can feel free to delete that file from disk which won't affect Xamarin's functionality.

We will work on getting this fixed soon, so the installer doesn't copy this extra file anymore.
Comment 14 Joaquin Jares 2017-06-05 15:59:36 UTC
Fixed.
Comment 15 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-05 19:01:48 UTC
## Bookkeeping note

I am setting the target milestone to 15.3 for verification based on Comment 14.  In the end this target milestone might end up being incorrect because Comment 14 does not mention a specific commit.  It is possible that whatever fix is being mentioned in Comment 14 is not included in the 15.3 branch.  In that case, it might only land on the timescale of the 15.4 target milestone.  The engineering team can either provide additional details about the location of the fix, or QA and I can attempt verification using an installer package from the 15.3 branch within the next week or so (after any candidate fix would assumably have been included into the latest development build).
Comment 16 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-22 23:30:58 UTC
Created attachment 23066 [details]
Verbose MSI installer log

## Verification status: not yet fixed as of latest 15.3 candidate build or "master" development build

BAD: XamarinVS master    (ac5f64c) (unpublished development build)
BAD: XamarinVS 4.6.0.271 (a5ed8bf) (unpublished candidate build)




## Environment info for this test

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3

Microsoft .NET Framework
Version 4.6.01586

Windows 10 version 1607 (OS Build 14393.0)
US English locale, US Eastern time zone
Comment 17 Jose Gallardo 2017-07-12 18:30:47 UTC
This issue is fixed on 15.4.
Marking as resolved for internal verification.
Comment 18 Swati Gangrade 2017-07-28 13:04:38 UTC
Created attachment 23879 [details]
MSInstallerLogs

Bug is retested in build info :-

- Xamarin 4.7.0.826 (fbf2099)
- Xamarin.Android 7.5.0.0 (bbf378a)
- Xamarin.iOS 10.14.0.0 (38d3a2b) 

Supplemental Build Info : https://gist.github.com/gangrade-swati/82deaf98c295a284eebe0cf8289cdbf8

Build is taken from- https://wrench.internalx.com/Wrench/ViewLane.aspx?lane_id=5156&host_id=406&revision_id=906390

============================================================================

## Actual Results

The installer creates the following directory and file: 
C:\ImportAfter\Xamarin.Common.targets 

Please refer the screencast and attached installer logs as reference 

## Expected results

The installer should not create a `C:\ImportAfter` directory. It would be `Xamarin.Common.targets` file is probably meant to go somewhere in the `C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.Targets` folder.
============================================================================

Screencast- https://www.screencast.com/t/Yj75ZHBzmfu

============================================================================

Hence reopening bug
Comment 19 Jose Gallardo 2017-08-16 14:44:51 UTC
I can confirm this issue is still reproducible on latest bits.
Moving to 15.5.
Comment 20 Pierce Boggan [MSFT] 2017-09-14 18:41:46 UTC
Given that the installer is not broken (we're just creating an extra file, per Comment #12), and that it's hard to justify engineering cycles on installer improvements in Visual Studio 2015 against other bugs (in 2015, 2017, and both), I'm marking this as RESOLVED-NOT-ON-ROADMAP.