I am trying to do an automated build using the command line for Visual Studio 2003. I have the following codes:
call "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"
Devenv /rebuild debug /project Project1 "C:\Builds\MyApp\Sample.sln"
Devenv /rebuild debug /project Project2 "C:\Builds\MyApp\Sample.sln"
Devenv /rebuild debug /project Project3 "C:\Builds\MyApp\Sample.sln"
In my script above, I build each project individually (like I saw in a tutorial on the internet). But each time I try to build, it throws me a lot of errors about the Microsoft Namespaces not being found. Below are sample error messages I get on the build:
Namespace or type 'Data' for the Imports
'Microsoft.Practices.EnterpriseLibrary.Data' cannot be found.
Namespace or type 'Sql' for the Imports
'Microsoft.Practices.EnterpriseLibrary.Data.Sql' cannot be found.
Namespace or type 'Logging' for the Imports
'Microsoft.Practices.EnterpriseLibrary.Logging' cannot be found.
Satellite assemblies could not be built because the main project
output is missing.
I have tried another method to build but this time it's the entire solution but still it gives me the same errors.
call "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"
Devenv C:\Builds\MyApp\Sample.sln /rebuild "Debug"
Can somebody please tell me what i'm missing?
I have over 50 projects in a single solution and it would really help me big time to create an automated build for this.
Thanks a lot! Cheers!
Don't "call" the "vsvars32.bat" file.
Use the full path for "Devenv.exe" (instead of #1).
Optionally: (maybe this is the kicker)..... cd to the directory where the .sln file resides.
"c:\myfullpath\Devenv.exe" /rebuild debug /project Project1 "C:\Builds\MyApp\Sample.sln"
Try that from the command line and see what happens.
Future Note:
In 2.0, you do NOT use "devenv.exe", you change it to msbuild.exe. (Just as an FYI).
You can also look up MSBee. (How to build 1.1 apps with msbuild).
EDIT
All of these lines are working for me.......I don't have VS2003 installed anymore. But I used VS2010 devenv.exe to run some samples.
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" MySolution.sln /clean
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /build debug /project MyProject001 MySolution.sln
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /rebuild debug /project MyProject001 MySolution.sln
Note, if I switch the /clean with the MySolution.sln (in the first example).....it fails. So there may be some ordering voodoo.
I'm not sure exactly what you want but to automate the compilation of my C# projects I use msbuild.
For example this is a code I use to build some XNA project games:
Sample Code:
#echo off
set path=%path%;C:\Windows\Microsoft.NET\Framework\v4.0.30319
Rem In the above line replace "v4.0.30319" with the latest framework version you have
Rem (or include the path to youy inbuilt compiler)
Msbuild "C:\Builds\MyApp\Sample.sln"
Now to meet any other requirements you want you can just type msbuild /? after you added it to your path environemtn variable. The best thing is this will be inbuilt for every windows computor!
Please ask if you want to know anything else, or if you want to do something else.
Try this:
Each of your Projects should have a reference to the "Microsoft.Practices.EnterpriseLibrary" - Files, dlls or whereever these are stored.
Maybe during an open IDE one holds a reference and copies it to the correspodending build folder. (After Build Task). While builing it independly the references could not be found.
If any copy tasks exist - Check the relative paths. Maybe your depended files targets to a different folder after build compared to build in the IDE.?
Just another idea..
Related
I am trying to compile a C VS project from PowerShell using msbuild. The command I'm using for now is:
msbuild .\my_solution.sln /t:Rebuild /p:Configuration=Release
But when I try to build I get the following error:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.props(31,5): error MSB4186: Invalid static method invocation syntax: "[Microsoft.Build.Utilities.ToolLocat
ionHelper]::FindRootFolderWhereAllFilesExist($(_VCTargetsPathFolders), $(_RelativeToolsetFiles))". Method 'Microsoft.Build.Utilities.ToolLocationHelper.FindRootFolderWhereAllFilesExist' not found. Static meth
od invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)).
I have already tried the following:
Run as admin
Repair Visual Studio
Full uninstall and reinstall of Visual Studio.
Other useful info:
I am using Visual Studio Community 2019.
My msbuild path is: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
My VCTargetsPath is: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\
Worth noting that on the CLI command I haven't added the additional include directories nor the additional dependencies while in the UI version I have. Despite this, the error I am expecting is somewhat like unknown reference to <function>. I am trying to solve this first error before proceeding to link the required libraries, I don't believe this causes the problem but I'm mentioning it just in case.
The strange thing is that if I rebuild using the Visual Studio UI the project builds without any problem.
Despite this, I need to build from CLI so I would be really thankful if someone shares where the problem may be.
Check your MSBuild version, I've had the same problem time ago.
For example:
msbuild
Microsoft (R) Build Engine version 4.0.30319 for .NET Framework
In my case (now), the latest version is 16.9.0 (Downloaded from here)
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET Framework
Check your Windows Path, when I got the problem, I got a Windows Path that contains an older version of MSBuild, checking the folder I saw "msbuild.exe". I Removed that entry and put the new one for my good msbuild.
%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
Seen on this post
This works well in my side with your description. So your environment has some problems.
Try these:
1) close VS IDE, run Developer Command Prompt for VS2019 as Administrator
type:
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Build.Framework.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Build.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Build.Engine.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Build.Conversion.Core.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Build.Tasks.Core.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Build.Utilities.Core.dll"
After that, restart it to test again.
This is up to your wish:
If it does not help, please run C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\layout\InstallCleanup.exe to uninstall all VS2017 andVS2019 versions with their registration information, any data. This is like a strong, thorough uninstallation.
Then, reinstall the version.
I have a dnn 7 website set up locally for development through dnndev.me. However I did not install the dnndev.me in the standard root folder c:\websites\dnndev.me\ it is in another location in my user documents. But the dnn installation works fine. So I added the dotnetnuke project templates and created a new project following the instructions on this page:
http://www.chrishammond.com/blog/itemid/2616/using-the-new-module-development-templates-for-dot.aspx
When I build the module in debug and then release it says build successful and there are no errors, however there is no install folder and no installation files.
Dose some one have an idea of how I can trouble shoot this?
Thanks in advance.
EDIT 1:
I have user both the C# and VB tempates as well as the Da2l and non-Dal2 templates. Same problem with every template.
Also,
I tried updating the MsBuildCommunity to the current version, that did not solve the problem either.
And i tried reinstallin ghte msbuild from the project manager command line - i got an error and did not solve the problem.
EDIT 2
So I am using version 2.5 of the templates. It appears that part of the build is working correctly because there are files generated and copied/created in the dnndev.me\bin folder and the desktopmodlue\MODULENAME\obj\debug folder.
I tried to run the build from the visual studio command prompt, here is the command prompt output from a newly created and un altered vb template with Dal2:
C:\websites\dnndev.me\DesktopModules\DNNModule1>msbuild DNNModule1.vbproj
Microsoft (R) Build Engine version 4.0.30319.33440
[Microsoft .NET Framework, version 4.0.30319.34003]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 11/29/2013 11:34:58 PM.
Project "C:\websites\dnndev.me\DesktopModules\DNNModule1\DNNModule1.vbproj" on
node 1 (default targets).
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output fi
les are up-to-date with respect to the input files.
CoreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Vbc.exe /noconfig /imports:Micr
osoft.VisualBasic,System,System.Collections,System.Collections.Generic,System
.Data,System.Linq,System.Diagnostics,System.Collections.Specialized,System.Co
nfiguration,System.Text,System.Text.RegularExpressions,System.Web,System.Web.
Caching,System.Web.SessionState,System.Web.Security,System.Web.Profile,System
.Web.UI,System.Web.UI.WebControls,System.Web.UI.WebControls.WebParts,System.W
eb.UI.HtmlControls /optioncompare:Binary /optionexplicit+ /optionstrict:custo
m /nowarn:42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 /option
infer+ /nostdlib /rootnamespace:Christoc.Modules.DNNModule1 /sdkpath:"C:\Prog
ram Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
/highentropyva- /doc:obj\Debug\DNNModule1.xml /define:"CONFIG=\"Debug\",DEBUG
=-1,TRACE=-1,_MyType=\"Custom\",PLATFORM=\"AnyCPU\"" /reference:C:\websites\d
nndev.me\bin\DotNetNuke.dll,C:\websites\dnndev.me\bin\DotNetNuke.WebUtility.d
ll,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFrame
work\v4.0\System.Configuration.dll","C:\Program Files (x86)\Reference Assembl
ies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll","C:\Program Files
(x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Dat
a.DataSetExtensions.dll","C:\Program Files (x86)\Reference Assemblies\Microso
ft\Framework\.NETFramework\v4.0\System.Data.dll","C:\Program Files (x86)\Refe
rence Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll","C:\Progr
am Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Sy
stem.Drawing.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Fram
ework\.NETFramework\v4.0\System.EnterpriseServices.dll","C:\Program Files (x8
6)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.dll
","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramew
ork\v4.0\System.Web.Extensions.dll","C:\Program Files (x86)\Reference Assembl
ies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Mobile.dll","C:\Program
Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Syst
em.Web.Services.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\F
ramework\.NETFramework\v4.0\System.Xml.dll" /debug+ /debug:full /out:obj\Debu
g\DNNModule1.dll /target:library Components\FeatureController.vb Components\I
temController.vb Components\Item.vb Settings.ascx.designer.vb Settings.ascx.v
b DNNModule1SettingsBase.vb Edit.ascx.designer.vb Edit.ascx.vb "My Project\As
semblyInfo.vb" DNNModule1ModuleBase.vb View.ascx.designer.vb View.ascx.vb "C:
\Users\Jordan\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttribute
s.vb"
vbc : warning BC40010: Possible problem detected while building assembly 'DNNMo
dule1': The version '00.00.01.*' specified for the 'file version' is not in the
normal 'major.minor.build.revision' format [C:\websites\dnndev.me\DesktopModul
es\DNNModule1\DNNModule1.vbproj]
CopyFilesToOutputDirectory:
Copying file from "obj\Debug\DNNModule1.dll" to "..\..\bin\DNNModule1.dll".
DNNModule1 -> C:\websites\dnndev.me\bin\DNNModule1.dll
Copying file from "obj\Debug\DNNModule1.pdb" to "..\..\bin\DNNModule1.pdb".
Copying file from "obj\Debug\DNNModule1.xml" to "..\..\bin\DNNModule1.xml".
Done Building Project "C:\websites\dnndev.me\DesktopModules\DNNModule1\DNNModul
e1.vbproj" (default targets).
Build succeeded.
"C:\websites\dnndev.me\DesktopModules\DNNModule1\DNNModule1.vbproj" (default ta
rget) (1) ->
(CoreCompile target) ->
vbc : warning BC40010: Possible problem detected while building assembly 'DNN
Module1': The version '00.00.01.*' specified for the 'file version' is not in t
he normal 'major.minor.build.revision' format [C:\websites\dnndev.me\DesktopMod
ules\DNNModule1\DNNModule1.vbproj]
1 Warning(s)
0 Error(s)
Time Elapsed 00:00:02.65
C:\websites\dnndev.me\DesktopModules\DNNModule1>
as for the MSBuild Community Tasks. I have the following folder in the packages directory:
MSBuildTasks.1.4.0.61. If I go to menu Tools -> Library Package Manager -> Manage NuGet Packages for Solution, the MsBuildTasks is listed in the installed packages (v 1.4.0.61).
EDIT 3
Okay, so i was thinking the same thing as chris in regards to the release vs debug setting. So i manually triggered a realease build using the command promt /p:configuration=release. THis caused a new error to appear:
C:\websites\dnndev.me\DesktopModules\DNNModule1>msbuild dnnmodule1.vbproj /p:Configuration=Release
Microsoft (R) Build Engine version 4.0.30319.33440
[Microsoft .NET Framework, version 4.0.30319.34003]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 11/30/2013 12:06:27 AM.
Project "C:\websites\dnndev.me\DesktopModules\DNNModule1\dnnmodule1.vbproj" on node 1 (default targets).
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
dnnmodule1 -> C:\websites\dnndev.me\bin\DNNModule1.dll
C:\websites\dnndev.me\DesktopModules\DNNModule1\BuildScripts\ModulePackage.targets(10,4): error MSB4062: The "MSBuild.Community.Tasks.XmlRead" task could not be loaded f
rom the assembly C:\websites\dnndev.me\DesktopModules\DNNModule1\BuildScripts\*Undefined*\packages\MSBuildTasks.1.4.0.61\tools\MSBuild.Community.Tasks.dll. Could not loa
d file or assembly 'file:///C:\websites\dnndev.me\DesktopModules\DNNModule1\BuildScripts\*Undefined*\packages\MSBuildTasks.1.4.0.61\tools\MSBuild.Community.Tasks.dll' or
one of its dependencies. The filename, directory name, or volume label syntax is incorrect. Confirm that the <UsingTask> declaration is correct, that the assembly and a
ll its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\websites\dnndev.me\DesktopModules\DNNMo
dule1\dnnmodule1.vbproj]
Done Building Project "C:\websites\dnndev.me\DesktopModules\DNNModule1\dnnmodule1.vbproj" (default targets) -- FAILED.
Build FAILED.
Here is the screen shot of where I switch to release from debug. I must be missing something obvious.
Make sure that you are switching to RELEASE mode in the Toolbar in VS, not just the project properties. If you don't see the build toolbar, I recommend you configure VS for C# mode instead of VB, then the dropdown becomes easy to access.
I am trying to use the SketchFlow Template for Windows Phone (http://wp7sketchflow.codeplex.com) with Blend for Visual Studio 2013 and when I try to create a project with the template I get this error:
New Project failed. Could not find file "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Blend
Preview\ProjectTemplates\en\CSharp\WindowsPhone\WindowsPhone\csWindowsPhonePrototype.zip[ControlLibrary\AssemblyInfo.cs].
I have looked inside the directory and the file does file exist. Does anyone have a solution? The only other stuff I found is http://wp7sketchflow.codeplex.com/discussions/429011.
Thanks,
I've also posted to that thread with a solution. Which I will also add here.
I've posted a fix for using this template with SketchFlow that ships in Blend/VS2013 (may work in 2012 but I didn't test).
Please read my instructions I've tried to be a clear as possible.
You WILL need to download and install the SketchFlowWP7.zip file from this codeplex (I also provide a copy in the link below).
Extract SketchFlowWP7.zip and run the SketchFlowWP7.msi to install.
When it prompts where to install choose the path to your copy of Blend. For instance for VS2013 it's default path is "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend"
Next you will need to navigate down into the following folder "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\ProjectTemplates\en\CSharp\WindowsPhone"
Here you will find a file names csWindowsPhonePrototype.zip, delete it. Yes really delete it, you are going to be replacing it's contents in the next steps.
Download the csWindowsPhonePrototype.zip from the following linkg - http://sdrv.ms/1hED9Cm
Extract the contents of csWindowsPhonePrototype.zip and you will have a folder called csWindowsPhonePrototype
Move the extracted folder into the "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\ProjectTemplates\en\CSharp\WindowsPhone" directory. PLEASE make sure that you don't have a folder called csWindowsPhonePrototype inside of it, if you do it's that child folder you need to move.
Now when you fire up Blend you should see an option for SketchFlow for Windows Phone.
I've written my first C#.NET WinForms application and am ready to publish the first build for users to install. I'm using log4net as my logging utility, and have it set as:
<appender name="ErrorAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Logs\"/>
<param name="AppendToFile" value="true"/>
<param name="DatePattern" value="yyyy-MM-dd' Log.txt'" />
// etc
When I build my application, however, nothing ever gets logged. While running in visual studio, everything goes to /bin/Debug/Logs/yyyy-MM-dd Log.txt.
How do I specify where my program should install to, and what the working directory should be?
Keep in mind this program is fairly minimal (<6K lines of code) and I don't really know the difference in all the publishing types inside of visual studio. I just want to distribute an .exe to my users and track errors under a directory such as C:\Program Files\myapp. What am I doing wrong?
EDIT: When I right click the program and go to Properties from within the solution explorer, I'm setting the following options (which may be incorrect, I've never done this before):
Build -> All Configurations -> Output Path: C:\Program Files\myapp\bin\
Debug -> All Configurations -> Working directory: C:\Program Files\myapp\bin\
Publish -> Publish Location: C:\Program Files\myapp\Publish\
Publish Wizard -> Publish Location: C:\Program Files\myapp\Publish\
Publish Wizard -> From a CD-ROM or DVD-ROM
Publish Wizard -> The application will not check for updates
Are these settings correct or am I royally screwing something up? What I would like is for the user to be prompted an install location (defaulted to: C:\Program Files\myapp), and this location always be used for the working directory (so I know where the log file is). How do I achieve this?
Since you are using Click Once for deployment, the application will not be in the typical C:\Program Files\myapp directory.
Vista and Windows 7:
C:\Users\<UserName>\AppData\Local\Apps\2.0\<obscure foler>\<obscure folder>
Windows XP:
C:\Documents and Settings\<UserName>\LocalSettings\Apps\2.0\<obscure foler>\<obscure folder>
Dig around in those directories and you should see the log4net files.
Edit
An alternative to Click Once deployment is the Visual Studio installer: Walkthrough: Deploying a Windows-based Application. This will allow you to install the application in the standard C:\Program Files\myapp directory.
I'd recommend you create few dummy projects with the installer to gain some familiarity with the various options. Initially, creating MSI's with the installer can seem daunting if you haven't used it before; after a bit of usage, the VS installer will become quite easy to use.
Another suggestion would be to test your installers on a virtual machine so you don't do anything inadvertently in your personal environment.
When running in Visual Studio the log files get written under the Debug folder as that's where the exe is.
When you install the application to C:\Program Files\myapp (or where ever) the logs will be created relative to that location and so should be in C:\Program Files\myapp\Logs/yyyy-MM-dd Log.txt - assuming that the user has rights to create directories and files at that location.
The simplest way to prove this is to install the application and run it. Then check where the log file is created.
Is there an easy way to create Silverlight 3 applications with F# (October CTP)?
I have seen the F# for Silverlight, but that only works with the May CTP.
I am using Visual Studio Integrated Shell 2008.
It is possible to use the May CTP templates with the October CTP version of F#
Create your new project, then unload it and edit the hint path for the FSharp.Core.dll to point to the October CTP,
<HintPath>$(ProgramFiles)\fsharp-1.9.7.8\Silverlight\2.0\bin\FSharp.Core.dll</HintPath>
then reload the project and build.
You do have to package the .xap file manually by e.g. using the chiron tool (or just zipping and renaming)
The AppManifest.xaml file looks like
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
RuntimeVersion="3.0.40818.0"
EntryPointAssembly="astroclock-fs"
EntryPointType="astroclock.fs.MyApp">
<Deployment.Parts>
<AssemblyPart x:Name="astroclock-fs" Source="astroclock-fs.dll" />
<AssemblyPart x:Name="FSharp.Core" Source="FSharp.Core.dll" />
</Deployment.Parts>
</Deployment>
where you fill in your own assembly name and entrypoint instead of mine
Create a folder in $(ProjectDir) to hold all the files to be packaged and copy C:\Program Files\FSharp-1.9.7.8\Silverlight\2.0\bin\FSharp.Core.dll into it, along with the AppManifest.xaml above
Create an empty file null.py in the folder to keep chiron quiet if you are using that tool
Add the following post-build steps
cd $(ProjectDir)
copy /y $(OutDir)$(TargetFileName) [your directory with all the output]
"C:\Program Files\IronPython 2.0\Silverlight\bin\chiron.exe" /d:[your directory with all the output] /z:app.xap
Create a test page to load app.xap
Build project
Load page in browser and enjoy
ADDED
You can make a permanent fix for the hint path needed to find FSharp.Core.dll by editing the template in C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache\FSharp\Silverlight\SilverlightLibrary3.zip\SilverlightLibrary.fsproj (and probably the version of the file in C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\FSharp\Silverlight\SilverlightLibrary3.zip just to be certain).
And a working proof of concept (source and everything bundled into the xap) here.
Looks like I got to wait for VS 2010.