是否有一种方法可以用新的.NET文件格式来针对.csproj
CompactFramework3.5?我希望能够针对以下框架:
<TargetFrameworks>netstandard2.0;netstandard1.0;net45;net40;net35;net35-cf</TargetFrameworks>
到目前为止,我所做的都是基于这个GitHub要点 --详细地说,我做了以下工作:
$(MSBuildBinPath)
替换为文件C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.CompactFramework.CSharp.targets
中的C:\Windows\Microsoft.NET\Framework\v3.5
C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE
toC:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\CompactFramework
RedistList\FrameworkList.xml
文件,内容如下:
<?xml version="1.0" encoding="utf-8"?> <FileList Redist="Net35-CF" Name=".NET Compact Framework 3.5"> </FileList>
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v3.5,Profile=CompactFramework
(只是键,没有值)TargetFrameworks
,并为net35-cf
添加条件属性组<PropertyGroup Condition="'$(TargetFramework)' == 'net35-cf'">
<!-- inference fails for this TFM, so specify it by hand -->
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile>CompactFramework</TargetFrameworkProfile>
<!-- define compilation constants by hand too -->
<DefineConstants>NET35_CF;WindowsCE</DefineConstants>
<!-- disable implicit references, these are specified by hand, below -->
<DisableImplicitFrameworkReferences>True</DisableImplicitFrameworkReferences>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net35-cf' ">
<NoStdLib>True</NoStdLib>
<NoConfig>true</NoConfig>
<FileAlignment>512</FileAlignment>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<PlatformID>E2BECB1F-8C8C-41ba-B736-9BE7D946A398</PlatformID>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net35-cf' ">
<Reference Include="mscorlib, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac" />
<Reference Include="System, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac" />
<Reference Include="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac" />
</ItemGroup>
然而,当我试图编译我的代码时,我会收到以下错误消息:
看来一般的编译是可行的,但是AssemblyFileVersionAttribute
不是紧凑框架的一部分吗?
更新1:当删除net35-cf
TFM时,项目编译得很好。
谢谢你提前帮忙!
发布于 2018-03-04 21:37:49
可以通过在AssemblyFileVersionAttribute
文件中指定AssemblyVersionAttribute
和.csproj
来禁用.csproj
和.csproj
的生成。
<PropertyGroup "'$(TargetFramework)' == 'net35-cf'">
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
</PropertyGroup>
https://stackoverflow.com/questions/49098134
复制相似问题