Skip to content

Commit

Permalink
Setting correct build action. Fixed #159
Browse files Browse the repository at this point in the history
  • Loading branch information
madskristensen committed Dec 16, 2015
1 parent a2a8982 commit 69bbbad
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- [ ] Preview window (#6)
- [ ] File globbing pattern support (#49)
- [ ] Run compilers from a node server
- [x] Updated to Babel 6 compiler
- [x] Set build action to "None" on default file (#159)

Features that have a checkmark are complete and available for
download in the
Expand Down
2 changes: 1 addition & 1 deletion src/WebCompilerVsix/Commands/CreateConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private void AddConfig(object sender, EventArgs e)
string defaultsFile = Path.Combine(folder, Constants.DEFAULTS_FILENAME);
ProjectHelpers.CheckFileOutOfSourceControl(defaultsFile);
handler.CreateDefaultsFile(defaultsFile);
ProjectHelpers.AddNestedFile(configFile, defaultsFile);
ProjectHelpers.AddNestedFile(configFile, defaultsFile, "None");
WebCompilerPackage._dte.StatusBar.Progress(true, "Creating defaults file", 3, 3);

CompilerService.Process(configFile, new[] { config });
Expand Down
32 changes: 22 additions & 10 deletions src/WebCompilerVsix/Helpers/ProjectHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,35 @@ public static void AddFileToProject(this Project project, string file, string it
if (project.IsKind(ProjectTypes.ASPNET_5))
return;


if (_dte.Solution.FindProjectItem(file) == null)
{
ProjectItem item = project.ProjectItems.AddFromFile(file);
item.SetItemType(itemType);
}
}

public static void SetItemType(this ProjectItem item, string itemType)
{
try
{
if (_dte.Solution.FindProjectItem(file) == null)
{
ProjectItem item = project.ProjectItems.AddFromFile(file);
if (item == null || item.ContainingProject == null)
return;

if (string.IsNullOrEmpty(itemType)
|| project.IsKind(ProjectTypes.WEBSITE_PROJECT)
|| project.IsKind(ProjectTypes.UNIVERSAL_APP))
return;
if (string.IsNullOrEmpty(itemType)
|| item.ContainingProject.IsKind(ProjectTypes.WEBSITE_PROJECT)
|| item.ContainingProject.IsKind(ProjectTypes.UNIVERSAL_APP))
return;

item.Properties.Item("ItemType").Value = "None";
}
item.Properties.Item("ItemType").Value = itemType;
}
catch (Exception ex)
{
Logger.Log(ex);
}
}

public static void AddNestedFile(string parentFile, string newFile)
public static void AddNestedFile(string parentFile, string newFile, string itemType = null)
{
ProjectItem item = _dte.Solution.FindProjectItem(parentFile);

Expand All @@ -137,6 +145,9 @@ public static void AddNestedFile(string parentFile, string newFile)
{
item.ProjectItems.AddFromFile(newFile);
}

ProjectItem newItem = _dte.Solution.FindProjectItem(newFile);
newItem.SetItemType(itemType);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -235,5 +246,6 @@ public static class ProjectTypes
public const string ASPNET_5 = "{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}";
public const string WEBSITE_PROJECT = "{E24C65DC-7377-472B-9ABA-BC803B73C61A}";
public const string UNIVERSAL_APP = "{262852C6-CD72-467D-83FE-5EEB1973A190}";
public const string NODE_JS = "{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}";
}
}

0 comments on commit 69bbbad

Please sign in to comment.