Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit f07ba11

Browse files
committed
Remove unnecessary generic project conversion code and unnecesssary reference to Microsoft.Build.Conversion which is now deprecated.
1 parent ea6a0e7 commit f07ba11

17 files changed

+23
-200
lines changed

src/Votive2022/Votive2022.csproj

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,20 @@
3030
<Reference Include="WindowsBase" />
3131
</ItemGroup>
3232
<ItemGroup Label="Suppressed items">
33-
<SuppressFromVsix Include="Microsoft.NET.StringTools.dll" />
34-
<SuppressFromVsix Include="Microsoft.VisualStudio.TextTemplating.dll" />
35-
<SuppressFromVsix Include="Microsoft.VisualStudio.TextTemplating.Interfaces.dll" />
36-
<SuppressFromVsix Include="Microsoft.VisualStudio.TextTemplating.VSHost.dll" />
37-
<SuppressFromVsix Include="System.Configuration.ConfigurationManager.dll" />
38-
<SuppressFromVsix Include="System.Security.Permissions.dll" />
39-
<SuppressFromVsix Include="System.Text.Encodings.Web.dll" />
40-
<SuppressFromVsix Include="System.Text.Json.dll" />
33+
<SuppressFromVsix Include="Microsoft.Bcl.AsyncInterfaces.dll" Visible="false" />
34+
<SuppressFromVsix Include="Microsoft.NET.StringTools.dll" Visible="false" />
35+
<SuppressFromVsix Include="Microsoft.VisualStudio.TextTemplating.dll" Visible="false" />
36+
<SuppressFromVsix Include="Microsoft.VisualStudio.TextTemplating.Interfaces.dll" Visible="false" />
37+
<SuppressFromVsix Include="Microsoft.VisualStudio.TextTemplating.VSHost.dll" Visible="false" />
38+
<SuppressFromVsix Include="Microsoft.VisualStudio.RpcContracts.dll" Visible="false" />
39+
<SuppressFromVsix Include="System.Buffers.dll" Visible="false" />
40+
<SuppressFromVsix Include="System.Configuration.ConfigurationManager.dll" Visible="false" />
41+
<SuppressFromVsix Include="System.IO.Pipelines.dll" Visible="false" />
42+
<SuppressFromVsix Include="System.Memory.dll" Visible="false" />
43+
<SuppressFromVsix Include="System.Numerics.Vectors.dll" Visible="false" />
44+
<SuppressFromVsix Include="System.Security.Permissions.dll" Visible="false" />
45+
<SuppressFromVsix Include="System.Text.Encodings.Web.dll" Visible="false" />
46+
<SuppressFromVsix Include="System.Text.Json.dll" Visible="false" />
4147
</ItemGroup>
4248
<ItemGroup>
4349
<ProjectReference Include="..\Schemas\v3\v3schemas.csproj">
@@ -59,10 +65,10 @@
5965
<Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
6066
</ItemGroup>
6167
<ItemGroup>
62-
<PackageReference Include="Microsoft.Build.Conversion.Core" Version="16.11.0" />
68+
<PackageReference Include="Microsoft.Build" Version="16.11.0" />
6369
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.11.0" />
6470
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.0.0-previews-4-31709-430" />
65-
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.0.5217-preview5" />
71+
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.0.5232" />
6672
<PackageReference Include="Nerdbank.GitVersioning" Version="2.2.33" />
6773
</ItemGroup>
6874
<ItemGroup>

src/votive.shared/ProjectBase/AssemblyReferenceNode.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
using Microsoft.VisualStudio.Shell;
1515
using Microsoft.VisualStudio.Shell.Interop;
1616
using Microsoft.VisualStudio.OLE.Interop;
17-
using MSBuild = Microsoft.Build.BuildEngine;
1817
using Microsoft.Build.Utilities;
1918
using System.Diagnostics.CodeAnalysis;
2019
using ShellConstants = Microsoft.VisualStudio.Shell.Interop.Constants;

src/votive.shared/ProjectBase/ConfigProvider.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using System.Globalization;
1010
using System.Collections;
1111
using System.IO;
12-
using MSBuild = Microsoft.Build.BuildEngine;
1312
using Microsoft.Build.Construction;
1413
using System.Collections.Generic;
1514
using System.Linq;

src/votive.shared/ProjectBase/ProjectElement.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ internal ProjectElement(ProjectNode project, string itemPath, string itemType)
141141

142142
private void DoAdd(string itemType, string itemPath)
143143
{
144-
var added = this.itemProject.BuildProject.AddItem(itemType, Microsoft.Build.BuildEngine.Utilities.Escape(itemPath));
144+
var added = this.itemProject.BuildProject.AddItem(itemType, MSBuild.ProjectCollection.Escape(itemPath));
145145
Debug.Assert(added.Count == 1, "adding a file created more than 1 new item, should not be possible since we escape wildcard characters");
146146
this.item = added[0];
147147
}
@@ -335,7 +335,7 @@ public string GetMetadataAndThrow(string attributeName, Exception exception)
335335

336336
public void Rename(string newPath)
337337
{
338-
string escapedPath = Microsoft.Build.BuildEngine.Utilities.Escape(newPath);
338+
string escapedPath = MSBuild.ProjectCollection.Escape(newPath);
339339
if (this.IsVirtual)
340340
{
341341
virtualProperties[ProjectFileConstants.Include] = newPath;

src/votive.shared/ProjectBase/ProjectFactory.cs

Lines changed: 1 addition & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Microsoft.VisualStudio.Package
2121
/// Creates projects within the solution
2222
/// </summary>
2323
[CLSCompliant(false)]
24-
public abstract class ProjectFactory : Microsoft.VisualStudio.Shell.Flavor.FlavoredProjectFactoryBase, IVsProjectUpgradeViaFactory
24+
public abstract class ProjectFactory : Microsoft.VisualStudio.Shell.Flavor.FlavoredProjectFactoryBase
2525
{
2626
#region fields
2727
private Microsoft.VisualStudio.Shell.Package package;
@@ -194,173 +194,5 @@ private IProjectEvents GetProjectEventsProvider()
194194
}
195195

196196
#endregion
197-
198-
#region IVsProjectUpgradeViaFactory
199-
private string m_lastUpgradedProjectFile;
200-
private const string SCC_PROJECT_NAME = "SccProjectName";
201-
private string m_sccProjectName;
202-
private const string SCC_AUX_PATH = "SccAuxPath";
203-
private string m_sccAuxPath;
204-
private const string SCC_LOCAL_PATH = "SccLocalPath";
205-
private string m_sccLocalPath;
206-
private const string SCC_PROVIDER = "SccProvider";
207-
private string m_sccProvider;
208-
public virtual int GetSccInfo(string projectFileName, out string sccProjectName, out string sccAuxPath, out string sccLocalPath, out string provider)
209-
{
210-
// we should only be asked for SCC info on a project that we have just upgraded.
211-
if (!String.Equals(this.m_lastUpgradedProjectFile, projectFileName, StringComparison.OrdinalIgnoreCase))
212-
{
213-
sccProjectName = "";
214-
sccAuxPath = "";
215-
sccLocalPath = "";
216-
provider = "";
217-
return VSConstants.E_FAIL;
218-
}
219-
sccProjectName = this.m_sccProjectName;
220-
sccAuxPath = this.m_sccAuxPath;
221-
sccLocalPath = this.m_sccLocalPath;
222-
provider = this.m_sccProvider;
223-
return VSConstants.S_OK;
224-
}
225-
226-
public virtual int UpgradeProject_CheckOnly(string projectFileName, IVsUpgradeLogger upgradeLogger, out int upgradeRequired, out Guid newProjectFactory, out uint upgradeCapabilityFlags)
227-
{
228-
newProjectFactory = GetType().GUID;
229-
upgradeCapabilityFlags = 0; // VSPPROJECTUPGRADEVIAFACTORYFLAGS: we only support in-place upgrade with no back-up
230-
231-
ProjectRootElement project = ProjectRootElement.Open(projectFileName);
232-
233-
// only upgrade known tool versions.
234-
if (string.Equals("3.5", project.ToolsVersion, StringComparison.Ordinal) || string.Equals("2.0", project.ToolsVersion, StringComparison.Ordinal))
235-
{
236-
upgradeRequired = 1;
237-
return VSConstants.S_OK;
238-
}
239-
240-
upgradeRequired = 0;
241-
return VSConstants.S_OK;
242-
}
243-
public virtual int UpgradeProject(string projectFileName, uint upgradeFlag, string copyLocation, out string upgradeFullyQualifiedFileName, IVsUpgradeLogger logger, out int upgradeRequired,
244-
out Guid newProjectFactory)
245-
{
246-
uint ignore;
247-
248-
this.UpgradeProject_CheckOnly(projectFileName, logger, out upgradeRequired, out newProjectFactory, out ignore);
249-
if (upgradeRequired == 0)
250-
{
251-
upgradeFullyQualifiedFileName = projectFileName;
252-
return VSConstants.S_OK;
253-
}
254-
255-
string projectName = Path.GetFileNameWithoutExtension(projectFileName);
256-
upgradeFullyQualifiedFileName = projectFileName;
257-
258-
// Query for edit
259-
IVsQueryEditQuerySave2 queryEdit = site.GetService(typeof(SVsQueryEditQuerySave)) as IVsQueryEditQuerySave2;
260-
261-
if (queryEdit != null)
262-
{
263-
uint editVerdict;
264-
uint queryEditMoreInfo;
265-
const tagVSQueryEditFlags tagVSQueryEditFlags_QEF_AllowUnopenedProjects = (tagVSQueryEditFlags)0x80;
266-
267-
int hr = queryEdit.QueryEditFiles(
268-
(uint)(tagVSQueryEditFlags.QEF_ForceEdit_NoPrompting | tagVSQueryEditFlags.QEF_DisallowInMemoryEdits | tagVSQueryEditFlags_QEF_AllowUnopenedProjects),
269-
1, new[] { projectFileName }, null, null, out editVerdict, out queryEditMoreInfo);
270-
if (ErrorHandler.Failed(hr))
271-
{
272-
return VSConstants.E_FAIL;
273-
}
274-
275-
if (editVerdict != (uint)tagVSQueryEditResult.QER_EditOK)
276-
{
277-
if (logger != null)
278-
{
279-
logger.LogMessage((uint)__VSUL_ERRORLEVEL.VSUL_ERROR, projectName, projectFileName,
280-
SR.GetString(SR.UpgradeCannotOpenProjectFileForEdit));
281-
}
282-
return VSConstants.E_FAIL;
283-
}
284-
285-
// If file was modified during the checkout, maybe upgrade is not needed
286-
if ((queryEditMoreInfo & (uint)tagVSQueryEditResultFlags.QER_MaybeChanged) != 0)
287-
{
288-
this.UpgradeProject_CheckOnly(projectFileName, logger, out upgradeRequired, out newProjectFactory, out ignore);
289-
if (upgradeRequired == 0)
290-
{
291-
if (logger != null)
292-
{
293-
logger.LogMessage((uint)__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, projectName, projectFileName,
294-
SR.GetString(SR.UpgradeNoNeedToUpgradeAfterCheckout));
295-
}
296-
297-
return VSConstants.S_OK;
298-
}
299-
}
300-
}
301-
302-
// Convert the project
303-
Microsoft.Build.Conversion.ProjectFileConverter projectConverter = new Microsoft.Build.Conversion.ProjectFileConverter();
304-
projectConverter.OldProjectFile = projectFileName;
305-
projectConverter.NewProjectFile = projectFileName;
306-
ProjectRootElement convertedProject = null;
307-
try
308-
{
309-
convertedProject = projectConverter.ConvertInMemory();
310-
}
311-
catch (Exception ex)
312-
{
313-
if (logger != null)
314-
logger.LogMessage((uint)__VSUL_ERRORLEVEL.VSUL_ERROR, projectName, projectFileName, ex.Message);
315-
}
316-
317-
if (convertedProject != null)
318-
{
319-
this.m_lastUpgradedProjectFile = projectFileName;
320-
foreach (ProjectPropertyElement property in convertedProject.Properties)
321-
{
322-
switch (property.Name)
323-
{
324-
case SCC_LOCAL_PATH:
325-
this.m_sccLocalPath = property.Value;
326-
break;
327-
case SCC_AUX_PATH:
328-
this.m_sccAuxPath = property.Value;
329-
break;
330-
case SCC_PROVIDER:
331-
this.m_sccProvider = property.Value;
332-
break;
333-
case SCC_PROJECT_NAME:
334-
this.m_sccProjectName = property.Value;
335-
break;
336-
default:
337-
break;
338-
}
339-
}
340-
try
341-
{
342-
convertedProject.Save(projectFileName);
343-
}
344-
catch (Exception ex)
345-
{
346-
if (logger != null)
347-
logger.LogMessage((uint)__VSUL_ERRORLEVEL.VSUL_ERROR, projectName, projectFileName, ex.Message);
348-
return VSConstants.E_FAIL;
349-
}
350-
if (logger != null)
351-
{
352-
logger.LogMessage((uint)__VSUL_ERRORLEVEL.VSUL_STATUSMSG, projectName, projectFileName,
353-
SR.GetString(SR.UpgradeSuccessful));
354-
}
355-
return VSConstants.S_OK;
356-
357-
}
358-
359-
this.m_lastUpgradedProjectFile = null;
360-
upgradeFullyQualifiedFileName = "";
361-
return VSConstants.E_FAIL;
362-
}
363-
364-
#endregion
365197
}
366198
}

src/votive.shared/ProjectBase/ProjectNode.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
using Microsoft.VisualStudio.Shell.Interop;
2121
using Microsoft.VisualStudio.Shell;
2222
using System.Net;
23-
using MSBuild = Microsoft.Build.BuildEngine;
2423
using MSBuildExecution = Microsoft.Build.Execution;
2524
using MSBuildConstruction = Microsoft.Build.Construction;
2625
using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;

src/votive.shared/ProjectBase/ProjectReferenceNode.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using Microsoft.VisualStudio.Shell;
1414
using Microsoft.VisualStudio.Shell.Interop;
1515
using Microsoft.VisualStudio.OLE.Interop;
16-
using MSBuild = Microsoft.Build.BuildEngine;
1716
using Microsoft.Build.Utilities;
1817
using VsCommands = Microsoft.VisualStudio.VSConstants.VSStd97CmdID;
1918
using VSConstants = Microsoft.VisualStudio.VSConstants;

src/votive.shared/PropertyPages/WixBuildEventsPropertyPage.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ namespace WixToolset.VisualStudioExtension.PropertyPages
66
using System.Globalization;
77
using System.Runtime.InteropServices;
88
using System.Windows.Forms;
9-
using Microsoft.Build.BuildEngine;
109
using Microsoft.VisualStudio;
1110
using Microsoft.VisualStudio.Package;
1211

src/votive.shared/PropertyPages/WixBuildPropertyPage.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace WixToolset.VisualStudioExtension.PropertyPages
88
using System.Globalization;
99
using System.Runtime.InteropServices;
1010
using System.Windows.Forms;
11-
using Microsoft.Build.BuildEngine;
1211
using Microsoft.VisualStudio;
1312
using Microsoft.VisualStudio.Package;
1413

src/votive.shared/PropertyPages/WixPropertyPage.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ namespace WixToolset.VisualStudioExtension.PropertyPages
1313
using System.Reflection;
1414
using System.Runtime.InteropServices;
1515
using System.Windows.Forms;
16-
using Microsoft.Build.BuildEngine;
1716
using Microsoft.VisualStudio;
1817
using Microsoft.VisualStudio.OLE.Interop;
1918
using Microsoft.VisualStudio.Package;

0 commit comments

Comments
 (0)