Skip to content

Commit 1015464

Browse files
matherm-aboehmunchase
authored andcommitted
fix: FIx more build warnings and WPF designer runtime errors
Exclude "compile" assets from packages that have reference assemblies, so that only implementation assemblies are used. This fixes WPF designer errors about loading reference assemblies on non-reflection context. Remove double usage of image files in shared project, because "Resource" and "Content" build action are redundant.
1 parent d8413b8 commit 1015464

5 files changed

Lines changed: 49 additions & 17 deletions

File tree

src/Unchase.OpenAPI.Connectedservice.Shared/Common/Commands/StackPanelChangeVisibilityCommand.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ namespace Unchase.OpenAPI.ConnectedService.Common.Commands
77
class StackPanelChangeVisibilityCommand :
88
ICommand
99
{
10-
public bool CanExecute(object parameter)
10+
11+
bool ICommand.CanExecute(object parameter)
1112
{
1213
return true;
1314
}
1415

15-
public void Execute(object parameter)
16+
void ICommand.Execute(object parameter)
1617
{
1718
(parameter as StackPanel)?.ChangeStackPanelVisibility();
1819
}
1920

20-
public event EventHandler CanExecuteChanged;
21+
event EventHandler ICommand.CanExecuteChanged { add { } remove { } }
2122
}
2223
}

src/Unchase.OpenAPI.Connectedservice.Shared/Unchase.OpenAPI.Connectedservice.Shared.projitems

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@
6767
<Content Include="$(MSBuildThisFileDirectory)Resources\logo_128x128.png">
6868
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
6969
</Content>
70-
<Content Include="$(MSBuildThisFileDirectory)Resources\NewBug.png">
71-
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
72-
</Content>
73-
<Content Include="$(MSBuildThisFileDirectory)Resources\preview_200x200.png" />
7470
<Resource Include="$(MSBuildThisFileDirectory)Resources\preview_200x200.png">
7571
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
7672
</Resource>
@@ -84,7 +80,9 @@
8480
</EmbeddedResource>
8581
</ItemGroup>
8682
<ItemGroup>
87-
<Resource Include="$(MSBuildThisFileDirectory)Resources\NewBug.png" />
83+
<Resource Include="$(MSBuildThisFileDirectory)Resources\NewBug.png">
84+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
85+
</Resource>
8886
</ItemGroup>
8987
<ItemGroup>
9088
<Page Include="$(MSBuildThisFileDirectory)Views\ConfigOpenApiEndpoint.xaml">

src/Unchase.OpenAPI.Connectedservice.Shared/ViewModels/ConfigOpenApiEndpointViewModel.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public ConfigOpenApiEndpointViewModel(UserSettings userSettings, Wizard wizard)
115115
Description = "Enter or choose an specification endpoint and check generation options to begin";
116116
Legend = "Specification Endpoint";
117117
InternalWizard = wizard;
118-
View = new ConfigOpenApiEndpoint(InternalWizard) {DataContext = this};
118+
View = new ConfigOpenApiEndpoint(InternalWizard) { DataContext = this };
119119
UserSettings = userSettings;
120120
ServiceName = string.IsNullOrWhiteSpace(userSettings.ServiceName) ? Constants.DefaultServiceName : userSettings.ServiceName;
121121
AcceptAllUntrustedCertificates = userSettings.AcceptAllUntrustedCertificates;
@@ -197,19 +197,17 @@ internal async Task<string> GetSpecificationAsync()
197197
UserSettings.Endpoint = UserSettings.Endpoint.TrimEnd('/') + "/$metadata";
198198
}
199199

200-
var proxy = UseWebProxy
201-
? new WebProxy(WebProxyUri, true)
202-
: WebProxy.GetDefaultProxy();
203-
204-
proxy.Credentials = UseWebProxy && UseWebProxyCredentials
205-
? new NetworkCredential(WebProxyNetworkCredentialsUserName,
206-
WebProxyNetworkCredentialsPassword, WebProxyNetworkCredentialsDomain)
207-
: CredentialCache.DefaultCredentials;
208200

209201
var httpHandler = new HttpClientHandler();
210202

211203
if (UseWebProxy)
212204
{
205+
var proxy = new WebProxy(WebProxyUri, true); /*WebRequest.DefaultWebProxy*/
206+
207+
proxy.Credentials = UseWebProxyCredentials
208+
? new NetworkCredential(WebProxyNetworkCredentialsUserName,
209+
WebProxyNetworkCredentialsPassword, WebProxyNetworkCredentialsDomain)
210+
: CredentialCache.DefaultCredentials;
213211
httpHandler.UseProxy = UseWebProxy;
214212
httpHandler.Proxy = proxy;
215213
httpHandler.PreAuthenticate = UseWebProxy;

src/Unchase.OpenAPI.Connectedservice.VS22/Unchase.OpenAPI.Connectedservice.VS22.csproj

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,45 @@
9494
<Version>17.0.31902.203</Version>
9595
</PackageReference>
9696
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.0.5233" />
97+
<PackageReference Include="Microsoft.Win32.Registry">
98+
<Version>5.0.0</Version>
99+
<PrivateAssets>compile; contentfiles; build; analyzers</PrivateAssets>
100+
<ExcludeAssets>compile</ExcludeAssets>
101+
</PackageReference>
102+
<PackageReference Include="Microsoft.Win32.Registry.AccessControl">
103+
<Version>5.0.0</Version>
104+
<PrivateAssets>compile; contentfiles; build; analyzers</PrivateAssets>
105+
<ExcludeAssets>compile</ExcludeAssets>
106+
</PackageReference>
97107
<PackageReference Include="NSwag.Commands">
98108
<Version>13.18.0</Version>
99109
</PackageReference>
100110
<PackageReference Include="NuGet.VisualStudio">
101111
<Version>6.0.0</Version>
102112
</PackageReference>
113+
<PackageReference Include="System.Numerics.Vectors">
114+
<Version>4.5.0</Version>
115+
<PrivateAssets>compile; contentfiles; build; analyzers</PrivateAssets>
116+
<ExcludeAssets>compile</ExcludeAssets>
117+
</PackageReference>
118+
<PackageReference Include="System.Security.AccessControl">
119+
<Version>5.0.0</Version>
120+
<PrivateAssets>compile; contentfiles; build; analyzers</PrivateAssets>
121+
<ExcludeAssets>compile</ExcludeAssets>
122+
</PackageReference>
123+
<PackageReference Include="System.Security.Principal.Windows">
124+
<Version>5.0.0</Version>
125+
<PrivateAssets>compile; contentfiles; build; analyzers</PrivateAssets>
126+
<ExcludeAssets>compile</ExcludeAssets>
127+
</PackageReference>
103128
<PackageReference Include="System.Text.Json">
104129
<Version>6.0.0</Version>
105130
</PackageReference>
131+
<PackageReference Include="System.Threading.AccessControl">
132+
<Version>5.0.0</Version>
133+
<PrivateAssets>compile; contentfiles; build; analyzers</PrivateAssets>
134+
<ExcludeAssets>compile</ExcludeAssets>
135+
</PackageReference>
106136
</ItemGroup>
107137
<ItemGroup>
108138
<EmbeddedResource Include="Properties\Resources.resx">

src/Unchase.OpenAPI.Connectedservice/Unchase.OpenAPI.ConnectedService.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@
284284
<PackageReference Include="System.Diagnostics.DiagnosticSource">
285285
<Version>4.6.0</Version>
286286
</PackageReference>
287+
<PackageReference Include="System.Numerics.Vectors">
288+
<Version>4.5.0</Version>
289+
<PrivateAssets>compile; contentfiles; build; analyzers</PrivateAssets>
290+
<ExcludeAssets>compile</ExcludeAssets>
291+
</PackageReference>
287292
<PackageReference Include="System.Reflection.Metadata">
288293
<Version>1.7.0</Version>
289294
</PackageReference>

0 commit comments

Comments
 (0)