dotnet / dotnet/sdk

unable to build VSIX-Extension project with 'dotnet build' - VSSDK1012 vs MSB3823

Open
#55,630 2 comments 1 reaction 1 assignee Claimed by @baronfel View on GitHub
Area-NetSDK
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug

In order to modernize older projects, and streamline/simplify/unify our workflows/pipelines, we hit a roadblock.
When trying to use `dotnet build` on the VSIX-Extension (the "old" style) project at first, i got.

> error MSB3823: Non-string resources require the property GenerateResourceUsePreserializedResources to be set to true.

which was kinda expected due to it being net472. However settings the property surfaced a different error, which i can find absolutely nothing about

> VSSDK : error VSSDK1012: The cto merger could not read the data from 'obj\Release\net472\VSPackage.resources.original'. This .resources file should not be read with this reader. The resource reader type is "System.Resources.Extensions.DeserializingResourceReader, System.Resources.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51".

is there a solution (other than keep using msbuild)? Do i have to split the project into a "bare bones" VSIX project, and a new project that contains the original code, and then reference that?
The "VSIX Project" template in Visual Studio only creates one project (VSIX+Code), it can be built using dotnet, but only because it does not contain non-string resources yet

### Steps to reproduce

Visual Studio:
- new Solution
- "VSIX Project"
- add Resx-File
- add an image for example, to Resx-File
- `dotnet build `

### Expected behavior

either
a) VSSDK be compatible with `System.Resources.Extensions`, thus `dotnet build` working
b) actual, discoverable documentation on `VSSDK1012` and how to solve it
c?) have the Visual Studio Template modified to create two projects with comments
- the "Analyzer with CodeFix (.NetStandard)" template does this with it's very specific design reccomendations (Analyzers and CodeFixes in different projects; additional, seperate projects for the NuGet and VSIX respectively)
- Image

### Actual behavior

- `dotnet build` is not possible "out of the box"
- additional steps needed to make it work
- absolutely zero documentation on `VSSDK1012`
(German UI and results)

Image

(English UI and results)
Image

### Is this a regression?

i guess not. `dotnet build` is new for our pipelines/workflows

### Are there any workarounds?

potentially splitting the VSIX project, which involves more work and testing, also because Resources are accessed through reflection, sometimes even indirectly, so finding and testing every(?) access works is tedious.

a) move 99% to a new Assembly, and reference that in the VSIX project. Only have the Main Package Class(es) in the VSIX Project.

b) In theory, only the actual Resources.resx have to be moved, but there is no clear way, if i could easily redirect all Reflection-Calls to the "new resx-only" assembly. But this might not work as the VSIX uses Winforms.

c) Changing all non-string resources to be EmbeddedResource also involves finding every spot. Again, might not work, because of Winforms.

d) migrating to the new VSSDK-Extensibility is not possible due to the Extensibility maturity, and our Extensions complexity (it would miss critical needed features)

so for us, the first options seems like the only viable one currently

### dotnet --info output

```console
.NET SDK:
Version: 10.0.400-preview.0.26322.102
Commit: 0cf89a94a1
Workload version: 10.0.400-manifests.11c77abd
MSBuild version: 18.9.0-preview-26322-102+0cf89a94a

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.400-preview.0.26322.102\

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
Version: 10.0.10
Architecture: x64
Commit: f7d90799ce

.NET SDKs installed:
7.0.102 [C:\Program Files\dotnet\sdk]
8.0.423 [C:\Program Files\dotnet\sdk]
9.0.205 [C:\Program Files\dotnet\sdk]
10.0.400-preview.0.26322.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.28 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.29 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
DOTNET_CLI_TELEMETRY_OPTOUT [true]
DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT [1]

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download
```

### IDE version

Visual Studio Enterprise Insiders [12023.133]

### Other details

we also have an internal CodeAnalyzer, which is distributed via NuGet and VSIX, but due to it using the split project design/template it worked out of the box.

the `Microsoft.VSSDK.BuildTools` NuGet Package has an Microsoft-internal repo/link as the "source repository", so i cannot make n issue at the appropriate space, I've also looked at other `microsoft` repos, but have not found one that sounds right

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.