I have installed Visual Studio 2008 on our build machine because we want to build the setup project to create MSI installer for our C# application.
From IDE, it works fine. The installer is created as expected.
Switch to command line, with the follow command the process finished without any error but there is no output (no installer created)
DevEnv.exe .\\SystemSoftwareInstaller\\SystemSoftwareInstaller.vdproj /build Debug /Out "debugErr.txt"
change the /build to /deploy to /rebuild have no difference (no installer created)
I am doing anything wrong?
I just fought with a similar issue, where I'd run the devenv.exe and get no feedback and no output, even with the /Log flag. This is the exact same call I'd use in 2005, and it worked like a charm. But then I found a devenv.com in the same folder, so I tried that, and it ran as expected. I don't know the difference between the .com and .exe versions, but you might try that.
I think the problem is that you are running DevEnv.exe and not DevEnv.com.
This should output to the console.
DevEnv .\\SystemSoftwareInstaller\\SystemSoftwareInstaller.vdproj /build Debug /Out "debugErr.txt"
Try building the solution file instead of the vdproj file in your command line statement
There must be at least one project in the solution that form the output of the installer project. These will need to be built as well.
Interesting question. I thought this would be pretty easy as well. I was able to easily do a release build by opening a VS2008 command prompt in the folder with my vdproj and running:
devenv SomeName.vdproj /build
But release was a lot trickier. After a few failed attempts on my own, this guy showed the way. For some reason, the fully qualified path to the sln and the vdproj seemed to do the trick (again I was in a VS2008 command prompt but this time I was in the SLN folder):
devenv "C:\SomePath\SomeSlnName.sln"
/rebuild Debug /project
"C:\SomePath\ProjectFolder\SomeProjectName.vdproj"
/projectconfig Debug
It doesn't make sense to create an installer for the Debug build, you always want the Release build.
If that's really necessary then open the .vdproj in Visual Studio, Build + Configuration Manager and tick the Build checkbox for the Debug configuration. Beware that this property is stored in the .sln file, not the .vdproj file so click File + Save All to let VS write the solution file.
Related
When I am using python in Visual Studio Code, I have the run button at the top right, however, when I am in a c# file, the run button is not there.
Why is that, and how can I fix it?
Since VS Code is a tool built with C# in mind, having the Run hidden is not a disadvantage but rather to dedicate a complete UI for Running and Debugging your C# code. The Run and Debug UI which you can access from the left menu gives your this capability with comprehensive tools to help you debug.
Activating this tool to run correctly involves two setups, one-time setup and a per-project setup (Don't let this intimidate you, it is just a click of a button)
First Time Setup
1. Install .NET command line tools
Install the .NET Core command line tools (CLI) by following the installation part of the instructions here: https://dotnet.microsoft.com/download
2. Install C# Extension for VS Code
In the extensions tab, enter C# in the search box and press Enter. Select the extension from Microsoft and click on Install. If you have previously installed the C# extension, make sure that you have a recent version.
3. Wait for download of platform-specific files
The first time that C# code is opened in VS Code, the extension will download the platform-specific files needed for debugging and editing. Debugging and editor features will not work until these steps finish.
Once Per Project
1. Get a project
You can start from scratch by creating an empty console project with dotnet new. Begin by opening the terminal in Visual Studio Code (View->Integrated Terminal) or CTRL+` and type these commands:
cd ~
mkdir MyApplication
cd MyApplication
dotnet new console
2. Open the directory in VS Code
Go to File->Open Folder (File->Open on macOS) and open the directory in Visual Studio Code. If this is the first time that the C# extension has been activated, it will now download additional platform-specific dependencies.
3. Add VS Code configuration files to the workspace
VS Code needs to be configured so it understands how to build your project and debug it. For this there are two files which need to be added -- .vscode/tasks.json and .vscode/launch.json.
Tasks.json is used to configure what command line command is executed to build your project, and launch.json configures the type of debugger you want to use, and what program should be run under that debugger.
Launch.json configures VS Code to run the build task from tasks.json so that your program is automatically up-to-date each time you go to debug it.
If you open the folder containing your project, the C# extension can automatically generate these files for you if you have a basic project. When you open a project and the C# extension is installed, you should see the following prompt in VS Code:
Clicking Yes when you see this prompt is all that you really have to do when you open a new dotnet project. If the files are there already you won't be prompted.
Clicking Yes on this prompt should add these resources. Should you need to add those resources manually please check the reference link below.
4. Start debugging
Your project is now all set. Set a breakpoint or two where you want to stop, click the debugger play button (or press F5) and you are off.
Reference Link: https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger.md
try pressing f5, should do the same thing as the run button
I am migrating current solution from VS2010 to VS2012, since web deployment projects are not supported i am trying "Publish" feature on the project.
My requirement is to run "Publish" on the project while running the build. This is a ".csproj" with publish method "File System" also on settings tab of publish i have "Precompile during Publishing" and "Merge all outputs into single assembly".
I can manually run publish by right clicking on project and selecting "Publish" and it gives desired single assembly and copies it to right location, i just need this to run on build
I have tried following to no avail
Adding single line to .csproj file
<DeployOnBuild>true</DeployOnBuild>
tried adding following lines to .csproj
<FilesToIncludeForPublish>OnlyFilesToRunTheApp</FilesToIncludeForPublish>
<DeployOnBuild>true</DeployOnBuild>
<DeployTarget>Package</DeployTarget>
<PackageAsSingleFile>true</PackageAsSingleFile>
Command line
MSBuild C:\MyProj.csproj /p:DeployOnBuild=true /p:PublishProfile=WebDeploy /p:CreatePackageOnPublish=True /p:VisualStudioVersion=11.0
Above command results in
Build started 07/04/2014 14:01:05.
Project "C:\MyProj.csproj" on node 1 (default targets).
Build:
Running Publish
_DeploymentUnpublishable:
Skipping unpublishable project.
Done Building Project "C:\MyProj.csproj" (default targets).
Build succeeded.
I'm glad you solved your problem, but I kept ending up here with my own searches, and it definitely wasn't McAfee (or any antivirus software) that was getting in my way. So for anyone else who ends up here, here's what eventually worked for me:
I realized that I was doing /t:Publish instead of /t:Package on the command line. Switching that bypassed the "Skipping unpublishable project" step.
The final command line should look like this (formatted for readability):
MSBuild C:\MyProj.csproj
/p:DeployOnBuild=true
/p:PublishProfile=WebDeploy
/p:CreatePackageOnPublish=True
/p:VisualStudioVersion=11.0
/p:OutputPath="bin\\"
/t:Package
To my surprise it turned out to be McAfee antivirus which is messing up "Publish" here, i was doing things right and it all works fine with McAfee turned off, somehow the antivirus stops the aspnet_compiler.exe to pre-compile the site and as a result the pre-compilation and subsequent merge steps(merge dlls into single assembly) fails, hope no one goes through same pain to find this out.
I had the same problem and the cause was this line in my .csproj:
<OutputType>WinExe</OutputType>
I changed it to be a Case Sensitive match with the rules in Microsoft.Common.targets:
<OutputType>winexe</OutputType>
I it worked!
Using MSBuild.exe command line, you can specify the output path like below:
You will explore on c:\Program Files(x86)\MSBuild\14.0\Bin ,Then you run this command:
.\MSBuild.exe [path of your project]/[projectName].csproj /P:Configuration=Release /p:Platform=AnyCPU / p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:outdir="c:\output\\" /p:VisualStudioVersion=14.0
Please pay attention that you must create the output folder.
If you are going to build all projects on solution you have to use below command:
.\MSBuild.exe [path of your project]/[solutionName].sln /P:Configuration=Release /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:outdir="c:\output\\"
anybody knows how to run unit test dlls built using mstest from the command line, without running VS
considering that on the machine there is .net 4.0 and VS2010 installed
I haven't done it myself, but I'd imagine that using the mstest command line is the way forward... if you've already tried that and had problems, please give more details.
mstest /testcontainer:path\to\tests.dll
EDIT: As noted in comments, you should either do this after putting the right directories on the path, or include the full path to mstest.exe.
Quick Answer :
Examples
You must use the /testcontainer option together with the /category option to select which tests in which categories to run. The following command, for example, is run in the solution folder and runs the tests that are in both the Priority 1 and ShoppingCart categories.:
MSTest /testcontainer: testproject2\bin\debug\testproject2.dll /category:"Priority1&ShoppingCart"
Note
Because the test assembly file resides in a different folder, a relative path is necessary,
If you are using test lists, it is best to use the /testmetadata option together with the /testlist option. The following command, for example, is run in the solution folder. Because the test metadata file also resides in that folder, no path is necessary:
MSTest /testmetadata:Bank.vsmdi /testlist:balancetests
Detailed :
To run tests from the command line
1.
Open a Visual Studio command prompt.
To do this, click Start, point to All Programs, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, and then click Visual Studio Command Prompt (2010).
By default, the Visual Studio command prompt opens to the following folder:
:\Program Files\Microsoft Visual Studio 10.0\VC
Note
To change the folder to which the command prompt window opens by default, click Start, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, right-click Visual Studio Command Prompt (2010), and then click Properties. In the Visual Studio Command Prompt (2010) Properties dialog box, you can change the path to the default folder in the Start in box.
2.
Either change directory to your solution folder or, when you run the MSTest.exe program in step 3, specify a full or relative path to the metadata file or to the test container.
To identify your solution folder, first identify the Visual Studio Projects folder. To do this, click Options on the Tools menu in Visual Studio, and then click Projects and Solutions. Under Visual Studio projects location, you see a path such as the following:
:\Documents and Settings\\My Documents\Visual Studio\Projects
Your solution folder is typically a child of this Projects folder, such as the Bank folder in the following example:
:\Documents and Settings\\My Documents\Visual Studio\Projects\Bank
3.
Run the MSTest.exe program.
When you run MSTest.exe, you must specify either a test metadata file or a test container, using either the /testmetadata option or the /testcontainer option, respectively. You use the /testmetadata option only once, to indicate one test metadata file. You can use the /testcontainer option multiple times, to indicate multiple test containers.
If necessary, include the path to the folder in which the metadata file or test container resides. Test metadata files reside in the solution folder.
Depending on the test type, test containers are XML files, assemblies built from test projects, or other files that reside in the folders of a test project.
Source: http://msdn.microsoft.com/en-us/library/ms182487(v=vs.100).aspx
Try this
mstest.exe /testcontainer:c:\projects\MyTests\Sampe.Tests.dll
Need to recompile my project (not large) under Windows 7 without setting up Visual Studio.
Is there any method to do that with minimum setup procedure. It's C# app, using System.Net.Sockets and some others from my other projects.
Should I set up whole VS to recompile just little code app? like batch build..
Or... is there any cloud/public servers with pre-installed different Operational Systems with Visual Studio, where I could upload my project and just re-build it under all platforms at once?
I use this batch script to compile my C# applications. Just pass in the solution name without the .sln extension
if exist %SYSTEMROOT%\Microsoft.NET\Framework\v3.5 set MSBUILDPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v3.5
if exist %SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319 set MSBUILDPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319
set MSBUILD=%MSBUILDPATH%\msbuild.exe
%MSBUILD% /nologo /m /p:BuildInParallel=true /p:Configuration=Release /p:Platform="Any CPU" "%1.sln"
Do you just want to use studio to compile without running the GUI? If so, you have at lot less work to do. Use devenv.exe.
http://msdn.microsoft.com/en-us/library/xee0c8y7%28v=vs.80%29.aspx
This should work for you:
csc /r:Reference1.DLL /r:Reference2.DLL /r:Reference3.DLL Main.cs...other cs
/r: pass refereences of your project
after, pass cs files separated by space
In order to run this in CMD o PowerShell, you may need to run *vcvars32.bat, which you can copy from machine where you have VS installed, or just, before inserting command, set complete path to csc.exe*
Regards.
With the .net Framework installed, you can just use msbuild or csc.exe.
Build project on commandline with msbuild.exe (comes with the framework).
No need to use devenv (which is vs) or csc (which requires you to specify dependencies etc.)
I have a solution file comprising of 15 projects using a few third party dll references. I want to be able to build the solution from a batch file. What is the best way to do this?
Thanks
Run msbuild - for example:
msbuild MySolution.sln /p:Configuration=Release /p:Platform="Any CPU"
One of the simplest ways is to execute msbuild with the solution file as input:
#echo off
call %windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe path\to\solution.sln
If this is done in a Visual Studio command prompt you can skip the path to msbuild.exe.
One way to get started is to open the project in Visual Studio and select Build | Rebuild Solution. Then go to View | Output. In the output window select "Build" in the Show Options From dropdown. This will display the commands that Visual Studio is using to build the project. You can paste those into a batch file, and read or modify them as desired.
If you want to maintain both Debug and Release versions of your application, then you will want to select the correct configuration and then follow the above steps for each version.