Unmovable files in VS2010 project - c++

I've got a Visual Studio 2010 C++ project. Previously everything was working fine but now when I create new files, they have strange little arrows in the corners. I've checked and they are not links, the files are at the hard location referenced. I've been through the project file and settings and cannot determine what on earth the difference is between them and my normal, good files. However, when I try to move these files to re-organize my project, Visual Studio won't move them. How can I solve this problem?
Here's (part of) the project file:
<ItemGroup>
<ClInclude Include="Interfaces\OS\OS.h" />
<ClInclude Include="Interfaces\Render\Math\colour.h" />
<ClInclude Include="Interfaces\Render\Math\Point.h" />
<ClInclude Include="Interfaces\Render\Math\rectangle.h" />
<ClInclude Include="Interfaces\Render\render.h" />
<ClInclude Include="Implementations\OS\Windows\Context.h" />
<ClInclude Include="Implementations\OS\Windows\Window.h" />
<ClInclude Include="Implementations\OS\Windows\Windows.h" />
<ClInclude Include="Implementations\Render\Direct3D9\Context.h" />
<ClInclude Include="Implementations\Render\Direct3D9\Direct3D9.h" />
<ClInclude Include="Implementations\Render\Direct3D9\Font.h" />
<ClInclude Include="Implementations\Render\Direct3D9\Label.h" />
<ClInclude Include="Implementations\Render\Direct3D9\Scene.h" />
<ClInclude Include="Implementations\Render\Direct3D9\Sprite.h" />
<ClInclude Include="Implementations\Render\Direct3D9\Texture.h" />
<ClInclude Include="UI\Context.h" />
<ClInclude Include="UI\Controls\Button.h" />
<ClInclude Include="UI\Controls\Context.h"/>
<ClInclude Include="UI\Division.h" />
</ItemGroup>
As you can see, all of the header files are listed equally, but only some of them are unmovable.

Apparently, this is something special. The problem only occurs if the root folder is named "UI". All other folder names work as expected. Re-creating the folder and files has no effect, but if the root folder is not named "UI", then everything correct. Going to chalk this one up to a Visual Studio error.

Related

Can ItemGroups in new VisualStudio 2017 csproj files be merged?

For example, I have a .csproj file with the following structure:
...
<ItemGroup>
<Compile Include="...">
<Link>...</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Include="..." Version="..." />
</ItemGroup>
... there may even be some other tags in between ItemGroups ...
<ItemGroup>
<ProjectReference Include="..." />
</ItemGroup>
<ItemGroup>
<Reference Include="...">
<HintPath>...</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Update="...">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
... There may be even more additional ItemGroups with other content ...
...
Can I merge them all into one, something like this?
...
<ItemGroup>
<PackageReference Include="..." Version="..." />
<ProjectReference Include="..." />
<Compile Include="...">
<Link>...</Link>
</Compile>
<Reference Include="...">
<HintPath>...</HintPath>
</Reference>
<None Update="...">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
...
I've done it, there seem to be no problem from what I observe at the moment, but I don't want me or other developers to run into them later, not knowing they may be linked to this action.
Merging them is no problem, it is equivalent from the MSBuild API.
However, some tooling may look for item groups containing only specific things (e.g. NuGet wants to add to item groups that already contain package references), but that means that in the worst case, tools may add additional item groups.

dotnet core, VS2017 15.5.4 is not publishing static html/js files from Ui folder

dotnet core 2.x, VS2017 15.5.4 is not publishing static html/js files from Ui folder.
We've combined out dotnet core Web Api and our Client UI, Aurelia into the same project. When I publish the Aurelia files are not being copied out, only the files in the Aurelia that are json. I thought I could right click the files and folders and set the Build Action property to Content but I get an error, see last image.
Here is my .csproj file
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>Web</AssemblyName>
<RootNamespace>Web</RootNamespace>
<TypeScriptToolsVersion>2.5</TypeScriptToolsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.Graph" Version="1.6.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="2.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.00" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
<ProjectReference Include="..\Lms\Lms.Service.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
Error when right clicking and click Properties from the menu I get this

Move existing file entries to project filter folders with visual studio

I am creating a C++ Visual Studio project.
I created a filter for all the headers and one for sources files. My files are in a folder with many sub folders.
Is there a way to add recursively all files *.h in my header folder and all the *.cpp in the source folder ?
My project :
The simplest solution for your problem seems to select each of the file entries in the Project-Explorer view, and drag and drop them to the filter folder you want them appearing.
Regarding to add new items you can select multiple files from the open file dialog, but you need to address each subdirectory separately.
Another option I could think of is to edit the .vxcproj.filters file directly in an appropriate text editor, or with a (XML) text processing tool.
If I open my projects .vxcproj.filters file in Notepad++ the relevant snippets look like this:
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Registry.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CommandId.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CommandBase.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Command1.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Command2.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CRTPSelfRegister.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>

msbuild Link step doesn't run

I'm trying to build a very simple C program using MSBuild. Previously this was put together by an intern using Visual Studio but we are not going to be using VS here and I want this built with MSBuild so I can automate it.
I have constructed my vcxproj file from scratch following the walkthrough on MSDN and the other reference docs there. I am able to compile the obj files no problem but the Link step never seems to run so I am not getting an executable output.
There is a function called main in AppDrv.c files, is it safe to assume that will be detected by the linker as the entry point, or do I need to tell msbuild manually some how that this is there?
Here is the entirety of my vcxproj. I can't find anything in the docs that says I need to tell it to link, shouldn't it happen automatically if the CL step completes OK? Do I need to somehow explicitly list the obj files to link, or can MSBuild figure that out on its own?
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.default.props" />
<PropertyGroup>
<ConfigurationType>Console</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<!--Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /-->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(UniversalCRT_IncludePath)$(ProjectDir)helper\include;$(WindowsSDK_IncludePath)$(VC_IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>slip_windows_helper.exe</OutputFile>
<ShowProgress>LinkVerbose</ShowProgress>
</Link>
</ItemDefinitionGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(UniversalCRT_IncludePath)$(ProjectDir)helper\include;$(WindowsSDK_IncludePath)$(VC_IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="$(ProjectDir)helper\src\AppDrv.c" />
<ClCompile Include="$(ProjectDir)helper\src\Buffers.c" />
<ClCompile Include="$(ProjectDir)helper\src\SingleThreadAsync.c" />
<ClCompile Include="$(ProjectDir)helper\src\Slip.c" />
<ClCompile Include="$(ProjectDir)helper\src\Utils.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(ProjectDir)helper\include\AppDrv.h" />
<ClInclude Include="$(ProjectDir)helper\include\Buffers.h" />
<ClInclude Include="$(ProjectDir)helper\include\SingleThreadAsync.h" />
<ClInclude Include="$(ProjectDir)helper\include\Slip.h" />
<ClInclude Include="$(ProjectDir)helper\include\Utils.h" />
<ClInclude Include="$(ProjectDir)helper\include\SharedHeader.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Targets" />
<Target Name="Info">
<Message Text="Target to output MSBuild information" />
<Message Text="OutputAssembly: $(OutputAssembly)" />
<Message Text="VCTargetsPath: $(VCTargetsPath)" />
<Message Text="Includes: $(IncludePath)" />
<Message Text="VC_IncludePath:$(VC_IncludePath)" />
<Message Text="WindowsSDK_IncludePath:$(WindowsSDK_IncludePath)" />
<Message Text="the property config is: $(Configuration)" />
<Message Text="final output directory: $(OutDir)" />
</Target>
</Project>
Here is the command I'm using to launch the build:
MSBuild.exe slipwinhelper.vcxproj /p:configuration=Debug /p:platform=Win32 /p:OutDir=target\ /nologo /t:Clean;Build;Info
UPDATE:
I got it to run the link task by overriding the AfterBuild event:
<Target Name="AfterBuild">
<Link Sources="Debug\AppDrv.obj;Debug\Buffers.obj;Debug\SingleThreadAsync.obj;Debug\Slip.obj;Debug\Utils.obj" />
</Target>
But now it is giving me unresolved externals on SetupApi calls in the code. I have tried changing the SubSystem to Windows, that doesn't seem to work.
A quick comparision with a VS generated files shows a bunch of differences/lacking properties, including the file from VS having
<ConfigurationType>Application</ConfigurationType>
whereas you are speciyfing Console which is not something msbuild recognizes.

Using LibTiff in Visual Studio 2010

I'm trying to use LibTiff in a C++ Program in Visual Studio 2010. I downloaded tiff-3.9.2.zip from ftp://ftp.remotesensing.org/pub/libtiff. To test LibTiff it would be nice if someone could give me a step by step instruction how to import libtiff to visual Studio and build the Fax2Tiff tool.
There are so many files so that I am totally confused.
What I already have done:
1) Created a new Empty Win32 Console Application Project named "TiffTest"
2) Copied the folder "libtiff" from the tiff-3.9.2.zip to the Project Folder
3) Copied the file "fax2tiff.c" to the Project Folder
4) Added those files to the Project
5) Added the "libtiff" folter to the additional include folders
6) Renamed the files "tif_config.vc.h" and "tiffconf.vc.h" to "tif_config.h" and "tiffconf.h"
7) Tried to compile it.
This does not really work. All I do to get rid of the error messages causes new error messages. Can anyone tell me how I can get libtiff to work?
I really need help...
Thank you so much!
I think it would be better
to build libtiff as a static library.
to build fax2tiff as a console application that links with the library
In addition, you should decide which version of the file- and memory-related files you want to use in your version of the library. There are Unix, DOS and Windows-style versions for file- and memory related files.
And for fax2tiff you will probably need Windows version of the getopt.c and getopt.h files. You may use wingetopt.h and wingetopt.c found on koders.com
I successfully use libtiff-3.9.4 and tiff2pdf built using this approach.
Btw, libtiff version 3.9.4 is most recent one in 3.x branch.
Below is the part of my LibTiff.vcxproj. It shows which files are needed to build libtiff on Windows using Visual Studio 2010.
<ItemGroup>
<ClInclude Include="t4.h" />
<ClInclude Include="tiff.h" />
<ClInclude Include="tiffconf.h" />
<ClInclude Include="tiffio.h" />
<ClInclude Include="tiffiop.h" />
<ClInclude Include="tiffvers.h" />
<ClInclude Include="tif_config.h" />
<ClInclude Include="tif_dir.h" />
<ClInclude Include="tif_fax3.h" />
<ClInclude Include="tif_predict.h" />
<ClInclude Include="uvcode.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="tif_aux.c" />
<ClCompile Include="tif_close.c" />
<ClCompile Include="tif_codec.c" />
<ClCompile Include="tif_color.c" />
<ClCompile Include="tif_compress.c" />
<ClCompile Include="tif_dir.c" />
<ClCompile Include="tif_dirinfo.c" />
<ClCompile Include="tif_dirread.c" />
<ClCompile Include="tif_dirwrite.c" />
<ClCompile Include="tif_dumpmode.c" />
<ClCompile Include="tif_error.c" />
<ClCompile Include="tif_extension.c" />
<ClCompile Include="tif_fax3.c" />
<ClCompile Include="tif_fax3sm.c" />
<ClCompile Include="tif_flush.c" />
<ClCompile Include="tif_getimage.c" />
<ClCompile Include="tif_jbig.c" />
<ClCompile Include="tif_jpeg.c" />
<ClCompile Include="tif_luv.c" />
<ClCompile Include="tif_lzw.c" />
<ClCompile Include="tif_next.c" />
<ClCompile Include="tif_ojpeg.c" />
<ClCompile Include="tif_open.c" />
<ClCompile Include="tif_packbits.c" />
<ClCompile Include="tif_pixarlog.c" />
<ClCompile Include="tif_predict.c" />
<ClCompile Include="tif_print.c" />
<ClCompile Include="tif_read.c" />
<ClCompile Include="tif_strip.c" />
<ClCompile Include="tif_swab.c" />
<ClCompile Include="tif_thunder.c" />
<ClCompile Include="tif_tile.c" />
<ClCompile Include="tif_unix.c" />
<ClCompile Include="tif_version.c" />
<ClCompile Include="tif_warning.c" />
<ClCompile Include="tif_write.c" />
<ClCompile Include="tif_zip.c" />