提交 54ec3764 编写于 作者: J Jared Parsons

Enforce VSIX projects are correctly marked

上级 02775edd
......@@ -21,6 +21,7 @@
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
<VSSDKTargetPlatformRegRootSuffix>Roslyn</VSSDKTargetPlatformRegRootSuffix>
<NoWarn>$(NoWarn);2008</NoWarn>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......
......@@ -39,6 +39,7 @@
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
......
......@@ -42,6 +42,7 @@
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DocumentationFile />
......
......@@ -52,6 +52,7 @@
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DocumentationFile />
......
......@@ -54,6 +54,7 @@
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DocumentationFile />
......
......@@ -37,6 +37,7 @@
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DocumentationFile />
......
......@@ -46,6 +46,7 @@
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DocumentationFile />
......
......@@ -19,6 +19,7 @@
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
<VSSDKTargetPlatformRegRootSuffix>Roslyn</VSSDKTargetPlatformRegRootSuffix>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......
......@@ -33,6 +33,7 @@
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
......
......@@ -47,6 +47,7 @@
<OptionExplicit>On</OptionExplicit>
<OptionCompare>Binary</OptionCompare>
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DocumentationFile />
......
......@@ -36,6 +36,7 @@
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......
......@@ -43,6 +43,7 @@
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......
......@@ -34,6 +34,7 @@
<ItemGroup>
<None Include="App.config" />
<None Include="project.json" />
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
......
......@@ -38,6 +38,7 @@ internal struct ProjectData
internal static class ProjectDataUtil
{
internal static readonly Guid FolderProjectType = new Guid("{2150E333-8FDC-42A3-9474-1A3956D46DE8}");
internal static readonly Guid VsixProjectType = new Guid("{82B43B9B-A64C-4715-B499-D71E9CA2BD60}");
internal static ProjectType GetProjectType(string path)
{
......
......@@ -65,13 +65,23 @@ private bool CheckForProperty(TextWriter textWriter, string propertyName)
private bool CheckRoslynProjectType(TextWriter textWriter)
{
var element = GetAllPropertyGroupElements().FirstOrDefault(x => x.Name.LocalName == "RoslynProjectType");
if (element == null)
var type = element?.Value.Trim();
var allGood = true;
if (type != null && !IsValidRoslynProjectType(type))
{
return true;
allGood = false;
textWriter.WriteLine($@"Value ""{type}"" is illegal for RoslynProjectType");
}
var value = element.Value.Trim();
switch (value)
allGood &= IsVsixCorrectlySpecified(textWriter, type);
return allGood;
}
private static bool IsValidRoslynProjectType(string type)
{
switch (type)
{
case "Dll":
case "ExeDesktop":
......@@ -86,11 +96,37 @@ private bool CheckRoslynProjectType(TextWriter textWriter)
case "Custom":
return true;
default:
textWriter.WriteLine($@"Value ""{value}"" is illegal for RoslynProjectType");
return false;
}
}
private bool IsVsixCorrectlySpecified(TextWriter textWriter, string roslynProjectType)
{
var element = GetAllPropertyGroupElements().FirstOrDefault(x => x.Name.LocalName == "ProjectTypeGuids");
if (element == null)
{
return true;
}
foreach (var rawValue in element.Value.Split(';'))
{
var value = rawValue.Trim();
if (string.IsNullOrEmpty(value))
{
continue;
}
var guid = Guid.Parse(value);
if (guid == ProjectDataUtil.VsixProjectType && roslynProjectType != "Vsix")
{
textWriter.WriteLine("Vsix projects must specify <RoslynProjectType>Vsix</RoslynProjectType>");
return false;
}
}
return true;
}
private IEnumerable<XElement> GetAllPropertyGroupElements()
{
var groups = _projectData.XPathSelectElements("//mb:PropertyGroup", _manager);
......
# BuildBoss
This is a tool to validate the content of our project files.
This is a tool to validate the content of our solutions and project files. The usage is very straight forward:
> BuildBoss.exe <solution path>
## Content verified
# Central properties
There are a number of MSBulid properties which are controlled by our central build files. Specifying them in an indivdiual project is potentially breaking our build expectations or simply creating redundant data. Hence these are not allowed. Some examples:
- FileAlignment
- SolutionDir
## Classifying projects
Our build process depends on being able to correctly classify our projects. This can typically be inferred from proerties like OutputType. But in other occasions it requires a more declarative entry via the RoslynProjectType property. The tool will catch places where projects are incorrectly classified.
This could be done using MSBuild targets but the logic is hard to follow and complicates the build. It's easier to verify here.
......@@ -23,6 +23,7 @@
<MinimumVisualStudioVersion>$(VisualStudioVersion)</MinimumVisualStudioVersion>
<TargetVsixContainerName>Roslyn.VisualStudio.RemoteHostClientMock.vsix</TargetVsixContainerName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<RoslynProjectType>Vsix</RoslynProjectType>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\EditorFeatures\TestUtilities\ServicesTestUtilities.csproj">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册