How to add macro under visual studio 2012 - visual-studio-2012

I just found that cocos2d-x 3.0 beta has defined own macro "$(EngineRoot)" under vs2012 proj, I want to know how to do it!
I can not upload the img...

Assuming you generate a cocos2d project using the cocos.py script as recommended in the docs, you'll find that EngineRoot is defined in the project's cocos2d_headers.props file near the top as follows:
<PropertyGroup Label="UserMacros">
<EngineRoot>$(MSBuildThisFileDirectory)..\..\</EngineRoot>
</PropertyGroup>
You should be able to do the same in your own (non-generated) project.

Related

JetBrains Rider run Pre/Post Build events when building in Rider

A project I'm working on has a csproj file with Pre/Post build events that only run when its being built in Visual Studio. It looks like this:
<Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true' ">
<!-- Pre build stuff -->
</Target>
Is there an equivalent condition for when a project is being built inside Rider, something like '$(BuildingInsideRider)'?
I reached out to Jetbrains support with the same question, and they told me the property name is '$(BuildingByReSharper)'. It's also worth noting that it's only useable in Rider 2021.1.3 and newer.

Android Studio Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'

I'm using Android Studio 1.5.1 and I did was i renamed a working project with a new package. After that, I encountered the problem i mentioned above.
I can't for the life of me figure out how to fix this. I've tried adding the dependency files already. All of the solutions points to editing build.gradle file but I don't have that file because this project is imported from a eclipse project. Can anyone help me please?
Regards,
Dexter
If you want to add dependency,follow the steps below.
1.file->new->Import Module.
after import module
2.file->Project Structure->app->dependency tab-> add library dependencies.
3.In build.gradle(your module) change to apply plugin: 'com.android.library'
if you get any error regarding min and target sdk versions, then choose 4th step other wise exclude 4th step(first 3 step enough).
4.file->Project Structure->example ->Flavors tab //change minimum and target sdk versions().

setting up google play expansion file library in android studio

I am trying to use apk expansion files in my android project, I've read this
http://developer.android.com/google/play/expansion-files.html
I tried to follow those steps, but I cannot figure out how to set up / include in my project / google play apk expansion library.
I've been searching for hours, didn't find right answer. Any help?
I just tried to set up the modules listed in http://developer.android.com/google/play/expansion-files.html today, but the play_apk_expansion/downloader_library cannot be imported as supplied.
The issue is a stale library reference in play_apk_expansion/downloader_library/project.properties
Update the last line from:
android.library.reference.1=../market_licensing
to:
android.library.reference.1=../../play_licensing/library
Note the extra ../
Then use File -> New -> Import Module... to import the play_apk_expansion/downloader_library as usual. It will also import the play_licensing/library as library but that can be renamed to something more useful afterwards.
I have not found a better way than importing via eclipse, so I have set up a github repo where this has already been done:
https://github.com/coltsoftware/ExpansionAPKsAndroidStudio
Copy sdk/extras/google/play_licening/library to Eclipse workspace
Copy sdk/extras/google/play_apk_expansion/downloader_library to Eclipse workspace
Eclipse: New --> Android project from sources to create two library projects from the above copied files. Don't forget to make the correct library reference to play_licening for downloader_library.
Android Studio: New --> Import Module, and import play_licening first, and then downloader_library.
To use Andrew's answer with Android Studio 2.1, I needed to update:
market_apk_expansion/downloader_library/project.properties
to
android.library.reference.1=../../market_licensing/library
before I could import the module as described.

Conditionally exclude files from VisualStudio 2013 C++ project based on file name

I'm trying to get Visual Studio 2013's msbuild .vcxproj to automatically mark certain .cpp project files as <ExcludedFromBuild>true</ExcludedFromBuild> based on the .cpp filename.
My goal is to allow my program (~100 developers, ~1000 vcxproj) to easily support Debug only compilations of unit test code, that would all be written in .cpp files that had a _utest.cpp suffix. Any .cpp files that ended in _utest.cpp would be automatically excluded from a release build, and the programmer could see that in Visual Studio's Solution Explorer when they were switched to a Release Solution Configuration.
I have been able to prevent the _utest.cpp-suffixed files from building in Release by adding this to my shared .props file
<Target Name="Remove _utest.cpp" BeforeTargets="ClCompile" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ItemGroup>
<ClCompile Remove="*_utest.cpp" />
</ItemGroup>
</Target>
but that doesn't give a visual indicator in Solution Explorer that the files are not part of the Release build.
I already tried a condition in an ItemDefinitionGroup that was based on %(Identity) but that didn't work
<ItemDefinitionGroup Condition="'%(Identity)'=='throttle_utest.cpp'">
<ClCompile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
</ItemDefinitionGroup>
(Visual Studio refused to load this one with an error "The reference to the built-in metadata Identity at position 1 is not allowed")
or
<ItemDefinitionGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch(%(Identity), '_utest\.cpp$'))">
<ClCompile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
</ItemDefinitionGroup>
(Visual Studio loaded with this change, but did nothing to exclude the matching files from building).
Is there a way I can conditionally exclude files based on filename and get a visual indicator in Solution Explorer?
I think something like this should work.
Right under the <Project> tag.
<ItemGroup Condition="'$(Configuration)'!='Debug'">
<ClCompile Include="*_utest.cpp">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
This works for me (was done entirely in VS2013 UI - right-click on Properties of source file and select Excluded from build: True for Release Configuration):
<ClCompile Include="foo_utest.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
NOTE: According to https://learn.microsoft.com/en-us/cpp/ide/vcxproj-file-structure?view=vs-2017 :
The Visual C++ project system currently does not support wildcards in project items.
For example, this is not supported:
<ClCompile Include="*.cpp"/>
Therefore each file should be excluded individually.

Visual Studio 2012 Displays Wrong Icon For Test Project

I have a sample solution that has a different "test" icon on one of the test projects, but not on the other two.
I thought that maybe the project type guid was different on this project, but in the solution file they all have the same project type (C#)
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Tests", "DomainModel.Tests\DomainModel.Tests.csproj", "{61A4733D-4C5B-4705-98CB-8048751BBEFA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Extensions.Tests", "Extensions.Tests\Extensions.Tests.csproj", "{1D6AA1C5-1FEC-44E4-9258-ACF84A20353C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Repository.Tests", "Repository.Tests\Repository.Tests.csproj", "{248434B7-3690-4705-85F0-66B765AEB431}"
EndProject
And in each project file they have idential project types (Test and C#)
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Why does DomainModel.Tests have the correct test icon, but Extensions.Tests and Repository.Tests have a plain C# library icon?
This can also happen in VS2013 when starting with a class library project and then adding test classes from there.
Adding the following child node to the main PropertyGroup node in the project file fixes the icon in this case:
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
This is fixed in the Visual Studio 2013 preview.
This problem isn't fixed in VS2012 Update 2 (VS2012.2).
I would expect that it will be fixed in the next version of Visual Studio if it isn't fixed in a quarterly update before then. With all of Microsoft moving to shorter release cycles (approximately 12 monthly) then we shouldn't have that long to wait; at least not compared to how long we've had to wait in the past! :-)

Resources