cs工程文件和nuspec文件的未来
Future of cs project file and nuspec file
我们已将我们的应用程序(由 20+ 个项目和 5 个可执行文件组成)移动到 asp net core (1.1) 和 project.json (.xproj)。
我们都搞定了 运行 但现在我们正在将某些项目作为包移动到我们的内部 nuget 提要中。我们可以使用 project.json 来创建 nuget 包,但我们仍然可以使用 nuspec 文件来创建包,(尽管这些占位符不再自动填充)。
自从微软宣布他们将放弃 project.json 并回到他们原来的 xml 项目结构后,我想知道 nuspec 支持会怎样?
我一直在研究这个,但找不到任何相关信息。
有谁知道这个项目文件的未来将如何包含 nuspec 支持,或者 nuspec 文件是否仍然需要?
找到相关资源:
我今天发现安装vs2017时安装了一个预览版(preview3)你也可以在这里找到它:https://github.com/dotnet/core/blob/master/release-notes/preview3-download.md
此新 SDK 包含一个 dotnet migrate
,可将 project.json 和 xproj 文件转换回 .csproj 文件。
新项目文件将如下所示:
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)$(MSBuildToolsVersion)\Microsoft.Common.props" />
<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
<AssemblyName>MyProject</AssemblyName>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
<EmbeddedResource Include="compiler\resources\**\*" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OtherProject.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161104-2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="NETStandard.Library">
<Version>1.6.1</Version>
</PackageReference>
<PackageReference Include="ServiceStack.Common.Core">
<Version>1.0.*</Version>
</PackageReference>
<PackageReference Include="ServiceStack.Text.Core">
<Version>1.0.*</Version>
</PackageReference>
<PackageReference Include="System.Linq.Queryable">
<Version>4.3.0</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
它确实包含使 packages.config 不必要的 nuget 包引用。它可能仍然需要像以前一样的 nuspec 文件。
背后的发现
是基于这些在项目文件上添加的 Xml 标签,并且默认 dotnet 添加了 msbuild prop 文件。 dotnet 将 onbuild 在内部将这些标记转换回 .nuspec
文件和 AssemblyVersionInfo 文件,然后使用这些文件构建它。
它超级hacky,但我想它有效。 (至少那是它在 NetStandard2.0 发布之前的工作方式,但我认为它仍然工作相同)
我们已将我们的应用程序(由 20+ 个项目和 5 个可执行文件组成)移动到 asp net core (1.1) 和 project.json (.xproj)。
我们都搞定了 运行 但现在我们正在将某些项目作为包移动到我们的内部 nuget 提要中。我们可以使用 project.json 来创建 nuget 包,但我们仍然可以使用 nuspec 文件来创建包,(尽管这些占位符不再自动填充)。
自从微软宣布他们将放弃 project.json 并回到他们原来的 xml 项目结构后,我想知道 nuspec 支持会怎样?
我一直在研究这个,但找不到任何相关信息。
有谁知道这个项目文件的未来将如何包含 nuspec 支持,或者 nuspec 文件是否仍然需要?
找到相关资源:
我今天发现安装vs2017时安装了一个预览版(preview3)你也可以在这里找到它:https://github.com/dotnet/core/blob/master/release-notes/preview3-download.md
此新 SDK 包含一个 dotnet migrate
,可将 project.json 和 xproj 文件转换回 .csproj 文件。
新项目文件将如下所示:
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)$(MSBuildToolsVersion)\Microsoft.Common.props" />
<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
<AssemblyName>MyProject</AssemblyName>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
<EmbeddedResource Include="compiler\resources\**\*" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OtherProject.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161104-2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="NETStandard.Library">
<Version>1.6.1</Version>
</PackageReference>
<PackageReference Include="ServiceStack.Common.Core">
<Version>1.0.*</Version>
</PackageReference>
<PackageReference Include="ServiceStack.Text.Core">
<Version>1.0.*</Version>
</PackageReference>
<PackageReference Include="System.Linq.Queryable">
<Version>4.3.0</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
它确实包含使 packages.config 不必要的 nuget 包引用。它可能仍然需要像以前一样的 nuspec 文件。
背后的发现
是基于这些在项目文件上添加的 Xml 标签,并且默认 dotnet 添加了 msbuild prop 文件。 dotnet 将 onbuild 在内部将这些标记转换回 .nuspec
文件和 AssemblyVersionInfo 文件,然后使用这些文件构建它。
它超级hacky,但我想它有效。 (至少那是它在 NetStandard2.0 发布之前的工作方式,但我认为它仍然工作相同)