error with bazel - trying to build windows version of tensorflow for visual studio
Hi, @scottsmallwood 

Apologize for the delay and it seems like this issue is more related with Microsoft C Compiler. Make sure MSVC 2019 PATH is properly set where the python is installed, so that `cl.exe` can be found and I found [similar issue](https://github.com/tensorflow/tensorflow/issues/54578), you can refer this [comment](https://github.com/tensorflow/tensorflow/issues/54578#issuecomment-1058568622) and you can refer this [documentation](https://code.visualstudio.com/docs/python/environments#:~:text=From%20within%20VS%20Code%2C%20you,environment%20types%3A%20Venv%20or%20Conda.)

Configure build environment by using below workaround if you're using `Miniconda` , I hope it will resolve your issue. 

You have to create, activate and configure Python environment. Run inside `VS2019 x64 Native Tools Command Prompt`shell command below. You have to correct paths according your Miniconda3 location.

```
%windir%\System32\cmd.exe "/K" 
C:\Users\gaikwadrahul8\Miniconda3\Scripts\activate.bat 
C:\Users\gaikwadrahul8\Miniconda3
```
If issue still persists please let us know ? or Could you please confirm if this issue is resolved for you ? Please feel free to close the issue if it is resolved ? Thank you!
 This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/59810">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/59810">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Build/Install

### Have you reproduced the bug with TF nightly?

Yes

### Source

source

### Tensorflow Version

tf2.11

### Custom Code

No

### OS Platform and Distribution

windows visual studio 2019

### Mobile device

no

### Python version

3.7

### Bazel version

5.3

### GCC/Compiler version

not sure

### CUDA/cuDNN version

none

### GPU model and memory

no

### Current Behaviour?

```shell
A bug happened!
```


### Standalone code to reproduce the issue

```shell
here is the command that i am running

bazel build //tensorflow::install_headers > w:\tmp\bazel_out.txt

any help much appreciated!!
```


### Relevant log output

```shell
In the file that i piped the output to i get this:
tensorflow/core/framework/tensor.cc(744): error C2248: 'tensorflow::TensorShapeBase<tensorflow::TensorShape>::TensorShapeBase': cannot access protected member declared in class 'tensorflow::TensorShapeBase<tensorflow::TensorShape>'
.\tensorflow/core/framework/tensor_shape.h(324): note: see declaration of 'tensorflow::TensorShapeBase<tensorflow::TensorShape>::TensorShapeBase'
.\tensorflow/core/framework/tensor_shape.h(359): note: see declaration of 'tensorflow::TensorShapeBase<tensorflow::TensorShape>'

here is the screen output that i am getting:  

W:\bb\git\tensorflow_old>bazel build //tensorflow:install_headers > w:\tmp\bazel_out.txt
Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=80
INFO: Reading rc options for 'build' from w:\bb\git\tensorflow_old\.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Options provided by the client:
  'build' options: --python_path=C:/Program Files/Python/Python3.7/python.exe
INFO: Reading rc options for 'build' from w:\bb\git\tensorflow_old\.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from w:\bb\git\tensorflow_old\.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=C:/Program Files/Python/Python3.7/python.exe --action_env PYTHON_LIB_PATH=C:/Program Files/Python/Python3.7/Lib --python_path=C:/Program Files/Python/Python3.7/python.exe --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions --define=override_eigen_strong_inline=true
INFO: Reading rc options for 'build' from w:\bb\git\tensorflow_old\.bazelrc:
  'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file w:\bb\git\tensorflow_old\.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file w:\bb\git\tensorflow_old\.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:windows in file w:\bb\git\tensorflow_old\.bazelrc: --copt=/W0 --host_copt=/W0 --copt=/Zc:__cplusplus --host_copt=/Zc:__cplusplus --copt=/D_USE_MATH_DEFINES --host_copt=/D_USE_MATH_DEFINES --features=compiler_param_file --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 --config=monolithic --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN --copt=-DNOGDI --host_copt=-DNOGDI --copt=/Zc:preprocessor --host_copt=/Zc:preprocessor --linkopt=/DEBUG --host_linkopt=/DEBUG --linkopt=/OPT:REF --host_linkopt=/OPT:REF --linkopt=/OPT:ICF --host_linkopt=/OPT:ICF --verbose_failures --features=compiler_param_file --distinct_host_configuration=false
INFO: Found applicable config definition build:monolithic in file w:\bb\git\tensorflow_old\.bazelrc: --define framework_shared_object=false --define tsl_protobuf_header_only=false
INFO: Analyzed target //tensorflow:install_headers (265 packages loaded, 13791 targets configured).
INFO: Found 1 target...
ERROR: W:/bb/git/tensorflow_old/tensorflow/core/framework/BUILD:769:16: Compiling tensorflow/core/framework/tensor.cc failed: (Exit 2): cl.exe failed: error executing command
  cd /d C:/users/scott.ad/_bazel_scott/24njqhju/execroot/org_tensorflow
  SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt
    SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\\x64;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\;;C:\Windows\system32;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
    SET PWD=/proc/self/cwd
    SET PYTHON_BIN_PATH=C:/Program Files/Python/Python3.7/python.exe
    SET PYTHON_LIB_PATH=C:/Program Files/Python/Python3.7/Lib
    SET RUNFILES_MANIFEST_ONLY=1
    SET TEMP=C:\Users\scott.AD\AppData\Local\Temp
    SET TF2_BEHAVIOR=1
    SET TMP=C:\Users\scott.AD\AppData\Local\Temp
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX64\x64\cl.exe @bazel-out/x64_windows-opt/bin/tensorflow/core/framework/_objs/tensor/tensor.obj.params
# Configuration: 548e4eb7c3a997dbe854b942bd4ad3607774b15376fbc38c5c147beb568995f0
# Execution platform: @local_execution_config_platform//:platform
cl : Command line warning D9002 : ignoring unknown option '/Zc:preprocessor'
Target //tensorflow:install_headers failed to build
ERROR: W:/bb/git/tensorflow_old/tensorflow/BUILD:1548:8 Executing genrule //tensorflow:install_headers failed: (Exit 2): cl.exe failed: error executing command
  cd /d C:/users/scott.ad/_bazel_scott/24njqhju/execroot/org_tensorflow
  SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt
    SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\\x64;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\;;C:\Windows\system32;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
    SET PWD=/proc/self/cwd
    SET PYTHON_BIN_PATH=C:/Program Files/Python/Python3.7/python.exe
    SET PYTHON_LIB_PATH=C:/Program Files/Python/Python3.7/Lib
    SET RUNFILES_MANIFEST_ONLY=1
    SET TEMP=C:\Users\scott.AD\AppData\Local\Temp
    SET TF2_BEHAVIOR=1
    SET TMP=C:\Users\scott.AD\AppData\Local\Temp
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX64\x64\cl.exe @bazel-out/x64_windows-opt/bin/tensorflow/core/framework/_objs/tensor/tensor.obj.params
# Configuration: 548e4eb7c3a997dbe854b942bd4ad3607774b15376fbc38c5c147beb568995f0
# Execution platform: @local_execution_config_platform//:platform
INFO: Elapsed time: 213.717s, Critical Path: 36.87s
INFO: 1962 processes: 484 internal, 1478 local.
FAILED: Build did NOT complete successfully
```
</details>