美文网首页Xamarin
研发相同的编译环境下,相同的C/C++/C#/VB工程,使用 V

研发相同的编译环境下,相同的C/C++/C#/VB工程,使用 V

作者: Xamarin信仰中心 | 来源:发表于2018-06-04 15:25 被阅读25次

    C# &&VB 部分

    从Visual Studio 2015(Roslyn 1.0)开始 ,V就支持 Deterministic 编译,可以参考下面的文档。

    https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/deterministic-compiler-option

    如果希望同时确保 pdb 文件一样支持 Deterministic 编译,则需要 Visual Studio 2015 Update 3 以后的版本。我们可以通过修改项目文件 .csproj 来配置有关信息:

    <Project>
      <PropertyGroup>
        <Deterministic>true</Deterministic>
        <Features>pdb-path</Features>
      </PropertyGroup>
    </Project>
    

    或者直接使用参数:

    csc /deterministic /features:pdb-path

    C && C++

    VS 中 C/C++ Deterministic 编译暂时不支持,目前产品组计划在 VS2017 Update 8 中开始提供 determinism 功能

    8/20/2018 Update :

    预计在 VS 2019 中正式 Release 这个功能

    We have an experimental version of this feature available in Visual Studio 2017 15.8 Preview 3, and would like to reach out to your contact to see if they are interested in trying this feature out and providing feedback.

    If you were expressed interest in a deterministic compilation mode in MSVC. Starting with Visual Studio 2017 15.8 Preview 3, we now have an experimental deterministic mode for C++. We are not quite ready to advertise this feature broadly, but would like to get some feedback on the feature from real-world scenarios. Our goal is to publicly release the feature once we’ve fixed any early adoption feedback bugs from you, in the Visual Studio 2019 series.

    We would very much appreciate any feedback on the use of this feature, including feedback on the interface, missing functionality, and any bugs you may encounter. If you’re interested in trying out this feature with your builds, please install Preview 3 (or later) of Visual Studio 2017 15.8 and see below for instructions on enabling the feature. Feedback can be sent directly to me. In any feedback, please include the specific scenario and your expectations for the feature, including how you would like to build on top of the feature in your build system.

    Enabling the feature

    This feature can be enabled through the use of two new command line options that are intended to be used together:


    image.png

    Limitations and known issues

    This experimental build has the following limitations:

    1. As an experimental feature the command line interface is subject to change in a future release.

    2. Path mapping is not completely implemented yet in all scenarios. Bit-for-bit identical builds will often but not always be generated when building the same project from different source roots mapped to the same target path.

    3. PDB files produced as part of a build are not bit-for-bit deterministic, but are equivalent and the PDB emitted from a particular instance of a deterministic build may be interchangeably used with the deterministic output of any other instance of the build.

    4. The debugging experience can be impacted by the use of the /pathmap: option as paths to source files will be rewritten. If the debugger cannot locate the files due to the rewritten path you will be prompted at debug time to provide the path to the files on disk. This will be addressed in an upcoming release. If relocatable deterministic builds are not required you may omit the /pathmap: option from the deterministic build. The compiler may emit warning C5049 when a full path is emitted in a deterministic build without being remapped, but this warning can be ignored or disabled, and the resulting binaries and PDBs can be used to debug exactly as per ordinary non-deterministic builds.

    5. Certain standard macros are incompatible with deterministic builds by their nature: DATE, TIME, and TIMESTAMP. Any expansion of these macros while in deterministic mode will trigger a level 1 compiler warning C5048 that the output will not necessarily be deterministic: "test.cpp(5): warning C5048: Use of macro 'TIMESTAMP' may result in non-deterministic output"

    6. The Microsoft Assembler does not yet support the /experimental:deterministic option. If your build contains assembly files you can use the internal switch /Brepro to enable deterministic builds in the assembler until the public /experimental:deterministic switch is enabled in this tool.

    7. The new command line switches are not yet exposed through either the IDE or MSBuild build files. They can be manually added to the IDE build through the advanced command line options, or to msbuild files with the AdditionalOptions parameter to the appropriate compile or link task.

    相关文章

      网友评论

        本文标题:研发相同的编译环境下,相同的C/C++/C#/VB工程,使用 V

        本文链接:https://www.haomeiwen.com/subject/umcysftx.html