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

Issues building the default analyzer + codefix template #718

Closed
Youssef1313 opened this issue Feb 2, 2021 · 8 comments
Closed

Issues building the default analyzer + codefix template #718

Youssef1313 opened this issue Feb 2, 2021 · 8 comments

Comments

@Youssef1313
Copy link
Member

See Youssef1313/YAnalyzers#7

With the first commit, I'm adding a GH Action that tries to build the default template. It fails with:

Error: /home/runner/.dotnet/sdk/5.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1060: Error reading assets file: Error loading lock file '/home/runner/work/YAnalyzers/YAnalyzers/YAnalyzers/YAnalyzers.CodeFixes/obj/project.assets.json' : 'home/runner/work/YAnalyzers/YAnalyzers/YAnalyzers/YAnalyzers/YAnalyzers.csproj*/1.0.0' is not a valid version string. (Parameter 'value') [/home/runner/work/YAnalyzers/YAnalyzers/YAnalyzers/YAnalyzers.CodeFixes/YAnalyzers.CodeFixes.csproj]

The reason is the path separator being the same as the package version separator on Linux.

This is caused by the usage of MSBuildProjectFullPath introduced with d4e9656. I'm not sure what the proper fix is.


With the second commit where I switched to Windows, it fails with:

C:\Users\runneradmin\.nuget\packages\microsoft.vssdk.buildtools\15.1.192\tools\VSSDK\Microsoft.VsSDK.targets(80,5): error MSB4062: The "CompareCommonBuildTaskVersion" task could not be loaded from the assembly C:\Users\runneradmin\.nuget\packages\microsoft.vssdk.buildtools\15.1.192\tools\VSSDK\Microsoft.VisualStudio.Sdk.BuildTasks.dll. Could not load file or assembly 'System.IO.Packaging, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [D:\a\YAnalyzers\YAnalyzers\YAnalyzers\YAnalyzers.Vsix\YAnalyzers.Vsix.csproj]

I can reproduce this behavior locally, but only from command-line build.
Building in Visual Studio works.

cc @jmarolf @sharwell

@Youssef1313
Copy link
Member Author

Commenting the Microsoft.VSSDK.BuildTools package reference fixes the issue:

<!--<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="15.1.192" PrivateAssets="all" />-->

Why is this package needed? Can it be safely removed from the template?

Youssef1313 added a commit to Youssef1313/YAnalyzers that referenced this issue Feb 2, 2021
Youssef1313 added a commit to Youssef1313/YAnalyzers that referenced this issue Feb 2, 2021
* Create dotnet.yml

* Use windows instead to workaround build failure on Linux

* Remove Microsoft.VSSDK.BuildTools

    See dotnet/roslyn-sdk#718 (comment)

* Disable some rules for tests
@sharwell
Copy link
Member

sharwell commented Feb 2, 2021

The vsix project does not support building with dotnet build. You can either create a solution configuration to exclude it, or create a solution filter (*.slnf) to build instead of the full solution.

The VSSDK build tools package is essential for correct behavior of the project it is installed in.

@Youssef1313
Copy link
Member Author

The VSSDK build tools package is essential for correct behavior of the project it is installed in.

Can you elaborate more on this? I'm getting the correct behavior without it when I set the Vsix project as the startup project and run it.

@sharwell
Copy link
Member

sharwell commented Feb 2, 2021

In that case, it's running an old version that was installed by a previous build.

@sharwell
Copy link
Member

sharwell commented Feb 2, 2021

I'm going to resolve this one as wontfix. It's technically can't fix, but the reason is external to this repository.

@Youssef1313
Copy link
Member Author

@sharwell The first issue (building on Linux) (wasn't discussed in comments) can probably have some fix.

@sharwell
Copy link
Member

sharwell commented Feb 2, 2021

@Youssef1313 This was already fixed for dotnet/roslyn-analyzers (dotnet/roslyn-analyzers@c0f21b4), so we could use the same approach here. We changed MSBuildProjectFullPath to MSBuildProjectFile.

@Youssef1313
Copy link
Member Author

@sharwell Thanks. Opened #720.

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

No branches or pull requests

2 participants