-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
Area: Task: GenerateResourceProblems with the task itself, resgen.exe, and resx resources in general.Problems with the task itself, resgen.exe, and resx resources in general.
Milestone
Description
From #2272 (comment)
cc @rainersigwald
Steps to reproduce
git clone https://github.com/PowerShell/PSScriptanalyzer
rm global.json # so that the latest version (3.0) of the SDK is used and not 2.2
cd Engine
dotnet build # should work
rm Strings.Designer.cs
dotnet build # does not work
Expected behavior
Build works
Actual behavior
Build fails due to errors resulting from Strings.Designer.cs not being created.
It seems one needs to apply the following non-intuitive changes to the Engine.csproj
:
- <ItemGroup>
- <Compile Update="Strings.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>Strings.resx</DependentUpon>
- </Compile>
- </ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Strings.resx">
- <Generator>ResXFileCodeGenerator</Generator>
+ <Generator>MSBuild:Compile</Generator><!-- Tell Visual Studio to run a build if the resx file changes -->
- <LastGenOutput>Strings.Designer.cs</LastGenOutput>
+ <StronglyTypedFileName>$(IntermediateOutputPath)\Strings.Designer.cs</StronglyTypedFileName>
+ <StronglyTypedLanguage>CSharp</StronglyTypedLanguage>
+ <StronglyTypedNamespace>Microsoft.Windows.PowerShell.ScriptAnalyzer</StronglyTypedNamespace>
+ <StronglyTypedClassName>Strings</StronglyTypedClassName>
</EmbeddedResource>
</ItemGroup>
+ <!-- For VS Code/OmniSharp support, ensure that CoreResGen runs before CoreCompile -->
+ <PropertyGroup>
+ <CoreCompileDependsOn>PrepareResources;$(CompileDependsOn)</CoreCompileDependsOn>
+ </PropertyGroup>
The StronglyTypedNamespace
is due to the following in the csproj: <RootNamespace>Microsoft.Windows.PowerShell.ScriptAnalyzer</RootNamespace>
However, having to supply all the other additional parameters seems unintuitive. I'd like to see a minimal solution for a csproj that also works with VS btw.
Environment data
msbuild /version
output:
OS info:
Windows 10 1809
.Net Core 3.0-rc1
tillig, Samuel12321, Starkie, jnm2, riverar and 11 more
Metadata
Metadata
Assignees
Labels
Area: Task: GenerateResourceProblems with the task itself, resgen.exe, and resx resources in general.Problems with the task itself, resgen.exe, and resx resources in general.