Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for dtproj and rptproj project file types #7

Open
icnocop opened this issue Aug 17, 2023 · 1 comment
Open

Support for dtproj and rptproj project file types #7

icnocop opened this issue Aug 17, 2023 · 1 comment

Comments

@icnocop
Copy link

icnocop commented Aug 17, 2023

Hi.

If I have an sln file which contains a dtproj or rptproj and a subsln file which includes the sln file, I get one of the following errors:

With dtproj:

ERROR: Failed to read project "C:\Work\Team\dev\MyApplication\Database.IntegrationServices\Database.IntegrationServices.dtproj".
---> Microsoft.Build.Exceptions.InvalidProjectFileException: The element <DeploymentModel> beneath element <Project> is unrecognized.  C:\Work\Team\dev\MyApplication\Database.IntegrationServices\Database.IntegrationServices.dtproj
   at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
   at Microsoft.Build.Construction.ProjectParser.Parse()
   at Microsoft.Build.Construction.ProjectParser.Parse(XmlDocumentWithLocation document, ProjectRootElement projectRootElement)
   at Microsoft.Build.Construction.ProjectRootElement..ctor(String path, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement.CreateProjectFromPath(String projectFile, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting)
   at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile, OpenProjectRootElement openProjectRootElement, Boolean isExplicitlyLoaded, Nullable`1 preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement.OpenProjectOrSolution(String fullPath, IDictionary`2 globalProperties, String toolsVersion, ProjectRootElementCacheBase projectRootElementCache, Boolean isExplicitlyLoaded)
   at Microsoft.Build.Evaluation.Project.ProjectImpl..ctor(Project owner, String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, ProjectCollection projectCollection)
   at SubSolution.MsBuild.MsBuildProjectReader.ReadProject(String absoluteProjectPath) in /_/Sources/SubSolution.MsBuild/MsBuildProjectReader.cs:line 94
   at SubSolution.MsBuild.MsBuildProjectReader.<>c__DisplayClass13_0.<ReadProjectAsync>b__0() in /_/Sources/SubSolution.MsBuild/MsBuildProjectReader.cs:line 54
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at SubSolution.MsBuild.MsBuildProjectReader.ReadProjectAsync(String absoluteProjectPath) in /_/Sources/SubSolution.MsBuild/MsBuildProjectReader.cs:line 54
   at SubSolution.MsBuild.MsBuildProjectReader.ReadAsync(String absoluteProjectPath) in /_/Sources/SubSolution.MsBuild/MsBuildProjectReader.cs:line 37

With rptproj:

ERROR: Failed to read project "C:\Work\Team\dev\MyApplication\Reports\Reports.rptproj".
---> Microsoft.Build.Exceptions.InvalidProjectFileException: The project file could not be loaded. 'Windows-1252' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')  C:\Work\Team\dev\MyApplication\Reports\Reports.rptproj
 ---> System.ArgumentException: 'Windows-1252' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')
   at System.Text.EncodingTable.InternalGetCodePageFromName(String name)
   at System.Text.EncodingTable.GetCodePageFromName(String name)
   at System.Text.Encoding.GetEncoding(String name)
   at Microsoft.Build.Internal.XmlReaderExtension..ctor(String file, Boolean loadAsReadOnly)
   at Microsoft.Build.Construction.ProjectRootElement.LoadDocument(String fullPath, Boolean preserveFormatting, Boolean loadAsReadOnly)
   --- End of inner exception stack trace ---
   at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
   at Microsoft.Build.Shared.ProjectFileErrorUtilities.ThrowInvalidProjectFile(BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
   at Microsoft.Build.Construction.ProjectRootElement.LoadDocument(String fullPath, Boolean preserveFormatting, Boolean loadAsReadOnly)
   at Microsoft.Build.Construction.ProjectRootElement..ctor(String path, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement.CreateProjectFromPath(String projectFile, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting)
   at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile, OpenProjectRootElement openProjectRootElement, Boolean isExplicitlyLoaded, Nullable`1 preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement.OpenProjectOrSolution(String fullPath, IDictionary`2 globalProperties, String toolsVersion, ProjectRootElementCacheBase projectRootElementCache, Boolean isExplicitlyLoaded)
   at Microsoft.Build.Evaluation.Project.ProjectImpl..ctor(Project owner, String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at SubSolution.MsBuild.MsBuildProjectReader.ReadProject(String absoluteProjectPath) in /_/Sources/SubSolution.MsBuild/MsBuildProjectReader.cs:line 113
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at SubSolution.MsBuild.MsBuildProjectReader.ReadProjectAsync(String absoluteProjectPath) in /_/Sources/SubSolution.MsBuild/MsBuildProjectReader.cs:line 88
   at SubSolution.MsBuild.MsBuildProjectReader.ReadAsync(String absoluteProjectPath) in /_/Sources/SubSolution.MsBuild/MsBuildProjectReader.cs:line 47

These errors occur even when I try to exclude the projects in the subsln file:

<?xml version="1.0"?>
<Subsln xmlns="http://subsln.github.io">
    <Root>
        <Folder Name="MyApplication">
            <Solutions Path="C:\Work\Team\dev\MyApplication\MyApplication.sln">
                <WhereProjects>
                    <ProjectNot>
                        <ProjectPath Match="**\*.dtproj" />
                        <ProjectPath Match="**\*.rptproj" />
                    </ProjectNot>
                </WhereProjects>
            </Solutions>
        </Folder>
    </Root>
</Subsln>

I ran subsln as follows:
subsln generate Test.subsln --import-fallback --debug --verbose --detailed

Ideally, I would like subsln to be able to keep the dtproj and rptproj projects in the generated sln file.

Support for dtproj and rptproj in Visual Studio 2022 are available using the following Visual Studio extensions:
https://marketplace.visualstudio.com/items?itemName=SSIS.MicrosoftDataToolsIntegrationServices
https://marketplace.visualstudio.com/items?itemName=ProBITools.MicrosoftReportProjectsforVisualStudio2022

Is there a way to allow subsln to read these projects?
If reading these project file types are not supported in subsln, can subsln still be able to generate an sln file, excluding these project files?
For example, can these errors be treated as warnings?
If so, maybe there should be a command line option to ignore these errors and continue generating the sln file.

Any other ideas?

Thank you!

@icnocop
Copy link
Author

icnocop commented Aug 17, 2023

I also tried creating the file after.{yoursolutionname}.sln.targets as indicated in the work-around here:
dotnet/msbuild#2064 (comment)

But that made no difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant