Visual Studio Pre-Build Variables (TextTransform.exe) - visual-studio

I need to use TextTransform and I have currently this pre-build Event, which it's working:
"%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\TextTransform.exe" -a !!BuildConfiguration!$(Configuration) "$(ProjectDir)Properties\AssemblyInfo.tt"
But I wanted to replace the \2019\Enterprise\ with variables according to the user version/edition, tried to google and search here but didn't found anything.

Found a solution, in this link have some really useful varaibles:
Link to all Visual Studio $ variables
Then I'm using:
MSBuildStartupDirectory
Which is:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE
Result:
"$(MSBuildStartupDirectory)\TextTransform.exe" -a !!BuildConfiguration!$(Configuration) "$(ProjectDir)Properties\AssemblyInfo.tt"

Related

Open a Html file inside Visual Studio

I have a post build event to generate some Html file, is there a way I can open it inside my Visual Studio for viewing as last step of my post build event command?
I tried to use call "my.htm" and it will open it in external default browser. I also tried to use devenv command in post build event, I just got some exception.
I just tested and it worked, so you should try this one here
In post-build define full path to your devenv. Just devenv didn't work
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe" /Edit "C:\Temp\aaa2.htm"

environment variable of visual studio path?

Thanks for reading this thread.
Basically I am wondering how I can use relative path/environment variable pointing to visual studio 2012 vcvarsall.bat file in a script?
I am currently using absolute path:
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86_amd64
How can I do something like this?
call "$(System)\$(Program Files)$(VS)\$(VC)\vcvarsall.bat" x86_amd64
Thanks a lot.
EDIT
What if I have more than one version of visual studio? I have vs2008 and vs2012 both installed on my computer.
Using a Visual Studio macro VCInstallDir
call $(VCInstallDir)vcvarsall.bat
Or without Visual Studio macros use VS110COMNTOOLS
call $(VS110COMNTOOLS)..\..\VC\vcvarsall.bat

Where can I find WSDL.exe?

I have Visual Studio 2010 Ulitmate (with MSDN Premium), but I can't seem to find this file.
I have tried installing the Visual Studio SDK but I can't seem to find the file.
I have looked in:
C:\Windows\Microsoft.NET\Framework\v3.5
C:\Windows\Microsoft.NET\Framework\v4.0.30319
C:\Program Files (x86)\Microsoft Visual Studio 10.0\SDK\v3.5
But I can't seem to find it.
(In case you are wondering, I need it to perform these steps.)
it should be under C:\Program Files (x86)\MicrosoftSdks\Windows\v7.0a\Bin . You should be able to use wsdl from visual studio command prompt and typing path in visual studio command prompt will give you the locations of all tools that you might need. Hope this helps
Visual Studio 2010 comes with its own command prompt with a lot of functionality ready to use. You can invoke the wsdl command from there
Can't run wdsl.exe directly from the command prompt because it's not in the DOS search path. You will need to explicitly indicate the full path to the wdsl.exe
I haven't tried the code below but you should be able to run it as a prebuild action on your project.
MsBuild script
<Target Name="UpdateWebReference">
<Message Text="Updating Web Reference..."/>
<Exec Command="wsdl.exe /o &quote;$(OutDir)&quote; /n &quote;$(WebServiceNamespace)&quote; &quote$(PathToWebServiceURL)&quote;"/>
</Target>

Error Code -1073741515 When Using EDITBIN

I'm using EditBin to increase the stack size of an application I'm writing. I have this in the post-build event command line for Visual Studio:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\editbin.exe" /STACK:268435456 "$(TargetPath)"
When I build my project, I get this error:
Error 470 The command ""C:\Program
Files (x86)\Microsoft Visual Studio
10.0\VC\bin\editbin.exe" /STACK:268435456 "[Target Executable]"" exited
with code -1073741515.
I have both of the following in my PATH environment variable:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
The command also works when I run it manually with cmd.exe. Does anyone know what the problem is here?
I had the same issue, how I resolved it:
Ran msbuild.exe <my.sln> /t:<mytargetproject> from a VS2010 command prompt, where <my.sln> is your solution name and <mytargetproject> is the project you are trying to build. For e.g. msbuild.exe helloworld.sln /t:mainproj.
When you do this or at least when I ran this, a dialog box popped up and said "foo.dll" cannot be found, I added the path of that dll to my "PATH" environment variable and the problem was solved! See ChrisF's comment to the question, as it says, the error is that some dll/component is missing.
From the dll name it complained about, I believe this is not contained to VS2010 libs/dlls, for me it was a third-party dll (which I am using and supposed to be available during the build) it was complaining about.
The best solution is to run the vcvarsall.bat located in the root of the visual studio install folder(C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC). That sets up the search folders for all MSVC compiler related tools.
I got this to work for now by copying mspdb100.dll into the same directory as editbin.exe, but this is not an optimal solution because every developer on my team will need to do the same thing.

How can I delete bad Visual Studio templates?

How do you remove the following noise templates that don't even work?
In Visual Studio: go to Tools > Extensions and Updates and then uninstall or disable the template.
To save a bit of time for 2010 users, the folder has moved:
...\My Documents\Visual Studio 2010\Templates\ProjectTemplates
For Visual Studio 2013, I found my template cache here:
%USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio\12.0\ProjectTemplatesCache
Deleting them off of disk should do the trick. Where they exist will depend a bit on where you installed them. If you installed them for all users they will be at
%ProgramFiles%\Microsoft Visual studio 9.0\Common7\Ide\ProjectTemplatesCache
For a single user they will be at
%USERPROFILE%\Visual Studio 2008\Templates\ProjectTemplates
EDIT
If InstallVSTemplates fails, it is likely one of the following. The one I can't help with is some program randomly dumping files inside of the ProjectTemplatesCache directory.
The other more likely cause is there is a bad template in the ProjectTemplates directory. InstallVSTemplates really just goes through this directory, and unzips all of the files into the ProjectTemplatesCache directory. You will have to search through this directory and find the .zip file which contains the junk files being added to your project Once you find the file, delete it, delete ProjectTemplatesCache, and then re-run InstallVSTemplates.
After manually searching for some of the custom profile templates(.vstemplate),I found them at the following location:
%userprofile%\AppData\Local\Microsoft\VisualStudio\10.0\Extensions
It appears VS2010 installs some of the templates as extesions or the authors made it that way.I hope this helps someone.
May need to run "devenv /setup" at the run command to refresh the VS2010 after you delete the templates.
For me it was a matter of removing it from here using VS2017:
%USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio\15.0_45552a03\ProjectTemplatesCache
Delete the bad/unwanted project folders from
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates
Clear cache
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache
Delete stuff from (perhaps not necessary)
C:\Users[Your User Name]\Documents\Visual Studio 2008\Templates\ProjectTemplates
and finally open Visual Studio 2008 Command Prompt as Administrator and run
devenv /installvstemplates
For me the issue got resolved when I deleted the cache.bin file from ItemTemplatesCache folder. Full path of this folder is:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache
Also make sure you delete the template files from below locations:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache
C:\Users\Default\Documents\Visual Studio 2010\Templates\ItemTemplates
C:\Users[NT-USERNAME]\Documents\Visual Studio 2010\Templates\ItemTemplates
For Visual Studio 2019:
Extensions > Manage extensions > Installed > Uninstall
Worke for VS 2012 and 2015 :
In Visual Studio: go to Tools > Extensions and Updates and then uninstall or disable the template.
worke in VS 2019 :
1- In VS2019, custom templates can be removed by deleting the template folder from %USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio{VSVersion}\ProjectTemplatesCache. Look for a {VSVersion} that begins with "16".
https://i.stack.imgur.com/V6SQ5.png
2- Delete What You Want From Templates Folder in {C:\Users\USERName\Documents\Visual Studio 2019\My Exported Templates}
Notes :
{ProjectTemplatesCache} Or {ItemTemplatesCache}
https://i.stack.imgur.com/9BM9p.png
For Visual Studio Express 2010 you should delete all folders under
%USERPROFILE%\AppData\Local\Microsoft\VCSExpress\10.0\Extensions
For Visual Studio 2013 Community, you have to delete {program folder}\Common7\IDE\ItemTemplatesCache\cache.bin after deleting all the unwanted files as described above. Afterwards VS will rebuild the templates listing in the New Project... dialog.
You could also try this:
dotnet new --uninstall <PATH|NUGET_ID>
It works for me in VS 2019 and VS 2022 to uninstall the Avalonia templates.
Description
The dotnet new --uninstall command uninstalls a template package at the PATH or NUGET_ID provided. When the <PATH|NUGET_ID> value isn't specified, all currently installed template packages and their associated templates are displayed. When specifying NUGET_ID, don't include the version number.
Examples
Uninstall the Avalonia templates
dotnet new --uninstall Avalonia.Templates
From MicrosoftDocs
If the template was installed by double clicking a VSIX file, it is considered an extension and can be uninstalled using the technique described by Hamid Behnam above. Otherwise, it can be deleted from one of the template directories mentioned above.
It looks like in each case we use different recipe. Unfortunately, commands line and VS menu command listed in this thread did not work in my case, which is MS VS 2019 Community Edition on Win7 x64:
First, close VS, remove unwanted *.zip files from all following folders, as well as hidden cache.bin file from the last \ProjectTemplatesCache folder (it will be restored at VS startup), then restart VS. Here are those 3 folders:
{Documents}\Visual Studio 2019\My Exported Templates
{Documents}\Visual Studio 2019\Templates\ProjectTemplates
{User}\AppData\Roaming\Microsoft\VisualStudio{Number}\ProjectTemplatesCache

Resources