Skip to content

Commit 968e0f5

Browse files
authored
[Directory.Build.props] Set dummy $(PackageVersion) to appease NuGet (#971)
Context: NuGet/Home#6461 Trying to build `Java.Interop.csproj` in Visual Studio currently fails with several errors such as: Error NETSDK1005: Assets file 'C:\…\xamarin-android\external\Java.Interop\tools\generator\obj\project.assets.json' doesn't have a target for 'net6.0'. Ensure that restore has run and that you have included 'net6.0' in the TargetFrameworks for your project. Even though we don't build NuGet packages, it still attempts to calculate the NuGet package name, which includes the assembly `$(Version)` if `$(PackageVersion)` isn't specified. Because our assemblies have different versions per-TFM (cbd9666, though note 3851b1a), that causes a problem because the package can't have multiple versions in it. Instead, set a dummy `$(PackageVersion)` value because we don't actually need it. Additionally, update `generator.slnf` for additional needed projects to build `generator`.
1 parent 05eddd9 commit 968e0f5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Directory.Build.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
<_OutputPath>$(MSBuildThisFileDirectory)bin\Build$(Configuration)\</_OutputPath>
99
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
1010
<ProduceReferenceAssemblyInOutDir>true</ProduceReferenceAssemblyInOutDir>
11+
12+
<!--
13+
Workaround for https://github.com/NuGet/Home/issues/6461 (VSWin Only)
14+
Even though we don't build NuGet packages, it still attempts to build the NuGet package name, which includes
15+
the assembly version if PackageVersion isn't specified. Because our assemblies have different versions
16+
per-TFM, that causes a problem because the package can't have multiple versions in it.
17+
Set a dummy PackageVersion because we don't actually need it.
18+
-->
19+
<PackageVersion>1.0.0.0</PackageVersion>
1120
</PropertyGroup>
1221

1322
<PropertyGroup>

tools/generator/generator.slnf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
"solution": {
33
"path": "..\\..\\Java.Interop.sln",
44
"projects": [
5+
"external\\xamarin-android-tools\\src\\Xamarin.Android.Tools.AndroidSdk\\Xamarin.Android.Tools.AndroidSdk.csproj",
56
"src\\Java.Interop.Localization\\Java.Interop.Localization.csproj",
67
"src\\Java.Interop.Tools.Cecil\\Java.Interop.Tools.Cecil.csproj",
78
"src\\Java.Interop.Tools.Diagnostics\\Java.Interop.Tools.Diagnostics.csproj",
89
"src\\Java.Interop.Tools.Generator\\Java.Interop.Tools.Generator.csproj",
910
"src\\Java.Interop.Tools.JavaCallableWrappers\\Java.Interop.Tools.JavaCallableWrappers.csproj",
11+
"src\\Java.Interop.Tools.JavaSource\\Java.Interop.Tools.JavaSource.csproj",
1012
"src\\Java.Interop.Tools.JavaTypeSystem\\Java.Interop.Tools.JavaTypeSystem.csproj",
1113
"src\\Xamarin.Android.Tools.AnnotationSupport\\Xamarin.Android.Tools.AnnotationSupport.csproj",
1214
"src\\Xamarin.Android.Tools.ApiXmlAdjuster\\Xamarin.Android.Tools.ApiXmlAdjuster.csproj",

0 commit comments

Comments
 (0)